EasyUI Forum
May 20, 2024, 04:15:24 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Set Row Value Edatagrid [Solved]  (Read 8536 times)
finzaiko
Newbie
*
Posts: 44


View Profile
« 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?
« Last Edit: May 19, 2014, 05:30:46 PM by finzaiko » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 19, 2014, 12:31:09 AM »

Please try the updated example http://jsfiddle.net/98SsR/1/.
Logged
finzaiko
Newbie
*
Posts: 44


View Profile
« Reply #2 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'
        }
    });
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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/
Logged
finzaiko
Newbie
*
Posts: 44


View Profile
« Reply #4 on: May 19, 2014, 05:30:17 PM »

Done, Thanks for your help..
Logged
karogel
Newbie
*
Posts: 28


View Profile
« Reply #5 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!