EasyUI Forum
May 21, 2024, 03:20:41 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: DataList doesn't refresh after updateRow  (Read 1206 times)
Wojak
Newbie
*
Posts: 48


View Profile Email
« on: June 29, 2023, 03:12:09 PM »

After usage updateRow it needs to use refreshRow.
Code:
$('#dl').datalist('updateRow', { index: idx, row: row}).datalist('refreshRow', idx);
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: June 30, 2023, 07:26:21 PM »

These codes do the same behaviour.
Code:
$('#dl').datalist('getRows')[idx] = row; // update the row value
$('#dl').datalist('refreshRow', idx);    // and then refresh it
Code:
$('#dl').datalist('updateRow', { index: idx, row: row});  // update and refresh it at the same time
Logged
Wojak
Newbie
*
Posts: 48


View Profile Email
« Reply #2 on: July 15, 2023, 11:52:47 AM »

Maybe there is a bug in my function?

Code:
function saveInfo() {
    if (!($('#form').form('validate'))) {
        return;
    }
    const formData = $('#form').serializeArray();
    if (fieldIdx >= 0) {
        const clickedField = $('#datalist').datalist('getRows')[fieldIdx];
        formData.forEach(e => {
            clickedField[e.name] = e.value;
        });
        $('#datalist').datalist('updateRow', { index: fieldIdx, row: clickedField }).datalist('refreshRow', fieldIdx);
    }
    $('#win').window('close');
}
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!