Request new features or modifications


Post by vadim_g »

Hi guys,

please add OOTB support for record.clone like:

import Model from '@bryntum/grid/source/lib/Core/data/Model';

Model.prototype.clone = function () {
	return this.copy(this.id);
};

Thanks
Vadim


Post by tasnim »

Hi Vadim,

Thanks — we already provide this via Model.copy(). See Model.copy.

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by vadim_g »

I saw it, we use very often clone...I think may be useful for others too, clone is different than copy


Post by tasnim »

Hi Vadim,

Model.copy is what we ship today: https://bryntum.com/products/grid/docs/api/Core/data/Model#function-copy

If you want a clone alias in your app you can add one easily. Example that by default creates a new id, but can preserve the id if desired:

import Model from '@bryntum/grid/source/lib/Core/data/Model';

Model.prototype.clone = function(preserveId = false) {
    return this.copy(preserveId ? this.id : undefined);
};

clone is different than copy

Could you please let us know what do expect from clone that you don't see in copy?

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post Reply