开发者

Use another property in data element as id

开发者 https://www.devze.com 2023-03-06 16:47 出处:网络
I have data elements: { \'rid\': \'1\', \'id\': \'2\', \'name\': \'asdw\' }, { \'rid\': \'2\', \'id\': \'2\',

I have data elements:

{
    'rid': '1',
    'id': '2',
    'name': 'asdw'
},
{
    'rid': '2',
    'id': '2',
    'name': 'dsddf'
},
{
    'rid': '3',
    'id': '2',
    'name': 'fffgg'
}

Each data 开发者_开发知识库element have the same value of "id" property (slickgrid throws me "Each data element must implement a unique 'id' property"). How can i use another property in data element as id (for example "rid")? I can not remove props from data object.


You can try setting your items using the setItems(data, objectIdProperty) method defined on DataView in file slick.model.js.

function setItems(data, objectIdProperty) {
     if (objectIdProperty !== undefined) idProperty = objectIdProperty;
     items = data;
     refreshIdxById();
     refresh();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消