EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: contestant on August 14, 2015, 02:49:33 PM



Title: How can trigger on change and set value for rows of propertygrid?
Post by: contestant on August 14, 2015, 02:49:33 PM
Hi
How do I can onChanged row value in propertygrid
And how do I can set new value for a costume row of propertygrid

For example set "width" row when I resized an element.

Thanks a lot :)


Title: Re: How can trigger on change and set value for rows of propertygrid?
Post by: contestant on August 15, 2015, 08:06:45 AM
There is no answer for me?!  ??? ??? ???

I found a solution, But its not perfect.

My Solution:
var properties = $("#tt").datagrid('getRows');
$.each(properties, function( index, value ) {
                    if(value['idname'] == "width")
                        value['value'] = $($this).css("width").replace(/[^-\d\.]/g, '');
                    else if(value['idname'] == "height")
                        value['value'] = $($this).css("height").replace(/[^-\d\.]/g, '');
                });
$("#tt").datagrid('loadData', properties);
Please give me a better solution, Thanks.


Title: Re: How can trigger on change and set value for rows of propertygrid?
Post by: CLKG on August 16, 2015, 07:30:18 PM
maybe you should use $('#tt').datagrid('updateRow', {}), but you need to gene the idx of rows when the data is loaded, and if showGroup=true, a re-index is needed after the data is loaded.


Title: Re: How can trigger on change and set value for rows of propertygrid?
Post by: contestant on August 17, 2015, 04:47:23 AM
Hi
Thanks my friend.
I use this both ways, But the my first way is faster than your way with updateRow, Because you need row index of row for updating.
Have a good time  ;)