admin管理员组

文章数量:1356345

I have the row data as below:

[{ordernum:'DD34345',item:{name:'pc',qty:88}}]

and I want an editor that can read and write the nested object 'item' property.

I know, I can do this by 'onBeginEdit' function to set the value and 'onEndEdit' function get the value and write it to the row data. But it is too complicated.

I want to modify the easyui resource code, or any other way to do this. When I define the column as:

{ field: 'item.qty', title: 'Quantity', width: 80, editor: { type: 'textbox' } }

it can read and write the field 'qty' of the nested object 'item'. If the nested object does not exist, when reading, then it returns an empty string.

When writing, then a new the nested object first and then set the value. And don't write the value to the row data as to:

[{ordernum:'DD34345','item.qty':88,item:{name:'pc',qty:88}}]

How to resolve my problem? Any help? Thanks in advance.

本文标签: How to edit nested object in jQuery easyuiStack Overflow