EasyUI Forum
November 01, 2025, 01:58:29 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: Combobox error/disintegrated after calling onSelect in edatagrid  (Read 7884 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« on: April 09, 2015, 02:43:23 AM »

Just look at this fiddle

http://jsfiddle.net/aswzen/wy787hsk/

this is data that showed on grid:
Code:
var data = [{
    brand_id: 'v11',
    brand_name: 'Marvell Semiconductor',
    date: '03/16/2015',
    cbx: 'true'
}, {
    brand_id: 'v21',
    brand_name: 'Kennedy Enterprise',
    date: null,
    cbx: true
}, {
    brand_id: 'v41',
    brand_name: 'Versatile Inc.',
    date: null,
    cbx: false
}];

in the fiddle i only show brand_name and data column ..
with edatagrid i can save data row by row..
now i just want to reload a row after updated but i can achieve it because there is no such method reloadRow() ,
there is only refreshRow() and thats only refresh the row with the older data, not updated data.

so i try to achieve it in this way
1. Click/DoubleClick the row to edit,
2. Select Brand in combobox. ( Error : Combobox disintegrated from panel/grid and appears on left top)
3. in onSelect method on combobox i try to get the selected row index.
4. Update the row with new data brand_id and brand_name based on selected index.
5. Click on another row to save current row.
6. Row will show the updated data.

this way works perfectly, but with error (no.2)

any explanation?

thankyou
« Last Edit: April 09, 2015, 02:47:00 AM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 09, 2015, 08:13:08 AM »

You do not need to call 'updateRow' or 'refreshRow' methods in the editing mode, just update the row data before ending the editing row.
Code:
$('#dg').edatagrid({
    onEndEdit: function(index,row){
        var ed = $(this).edatagrid('getEditor',{index:index,field:'brand_id'});
        var cc = $(ed.target);
        $.extend(row, {
            brand_id: cc.combobox('getValue'),
            brand_name: cc.combobox('getText')
        });
    }
})

The updated example is available from here: http://jsfiddle.net/wy787hsk/1/
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!