EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: finzaiko on May 18, 2014, 07:25:00 PM



Title: Set Row Value Edatagrid [Solved]
Post by: finzaiko on May 18, 2014, 07:25:00 PM
I tried to make the lookup function item details in a edataGrid, how to set value in edatagrid, I add a new row and then I set the value to the row, I've been looking at the doc edatagrid but currently do not have the setValue method, if I use addrow method its work.
Code:
function setRowValue() {
    $('#dg').edatagrid('addRow', {index: 0, row: {itemid: 'ini nilai test'}});
}

here is my test code : http://jsfiddle.net/98SsR/
is there another way to set the value in edatagrid?


Title: Re: Set Row Value Edatagrid
Post by: stworthy on May 19, 2014, 12:31:09 AM
Please try the updated example http://jsfiddle.net/98SsR/1/.


Title: Re: Set Row Value Edatagrid
Post by: finzaiko on May 19, 2014, 03:01:38 AM
Thanks stworthy for your reply, yes that's work when using addRow method
but how without add new row when I set the value to the row or how set value when I edit the row?
is posible like this ?
Code:
$('#dg').edatagrid('setRow', { // This not working, no method setRow as the following doc http://www.jeasyui.com/extension/edatagrid.php
        index: 0,
        row: {
            itemid: 'test item'
        }
    });


Title: Re: Set Row Value Edatagrid
Post by: stworthy on May 19, 2014, 06:52:27 AM
If you want to update the editing row's data, please get the editor of the specified row and then update this editor with a new value.
Code:
var dg = $('#dg');
var dg.edatagrid('editRow', index);  // edit a row
var ed = dg.edatagrid('getEditor', {index:index, field:'itemid'});  // get the editor
$(ed.target).val('new itemid');

The updated example is also available from http://jsfiddle.net/98SsR/2/


Title: Re: Set Row Value Edatagrid
Post by: finzaiko on May 19, 2014, 05:30:17 PM
Done, Thanks for your help..


Title: Re: Set Row Value Edatagrid
Post by: karogel on October 05, 2015, 11:39:37 PM
Please try the updated example http://jsfiddle.net/98SsR/1/.


sir how if i the value to be set to row(s) are variables