EasyUI Forum
December 08, 2024, 06:24:37 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: update datagrid cell text  (Read 6174 times)
fmdano
Newbie
*
Posts: 22


View Profile Email
« on: December 29, 2022, 01:16:06 PM »

Hey
so i have a grid and a subgrid. I have the ability to edit a numeric field in the subgrid. When I do this,  I need to add the field in the parent grid and the sub grid. I have done that in a js function. Once this new number is calculated, I need to update the value and the text display in the parent grid cell.
I set up a read only editor on the parent grid cell if that helps...

I have done this using the .datagrid('updateRow', { } code, but this code seems to update the parent grid and then close the sub grid that was expanded so I lose the actual number I edited in the sub grid.


Any thought how to update the text display in a cell where it will not close/hide the subgrid, or keep the updateRow code from closing the subgrid expantion?

thanks
Logged
jarry
Administrator
Hero Member
*****
Posts: 2278


View Profile Email
« Reply #1 on: December 30, 2022, 01:53:04 AM »

If you are using the detail view extension, please set the 'autoUpdateDetail' property to false.
Logged
fmdano
Newbie
*
Posts: 22


View Profile Email
« Reply #2 on: December 30, 2022, 05:52:07 AM »

I am not clear how adding this to the grid: 'autoUpdateDetail' is going to help...I added that to the data grid attribute list, but nothing happened.
I have tried this below:
$('#dg').datagrid('getRows')[parent_row]['site_allocation'] = 22000;

console.log('site alloc: ' + $('#dg').datagrid('getRows')[parent_row]['site_allocation']);

when I look at the console, I see the value is now 22000, but in the datagrid it is still showing the old data value...I thought the code above would work, but it did not.

Logged
fmdano
Newbie
*
Posts: 22


View Profile Email
« Reply #3 on: December 30, 2022, 08:15:50 AM »

I am wondering if other parts of my code were broken and caused the updateRow to not work, because this morning I put this code back into my codebase and it worked:
$('#dg').datagrid('updateRow', {
    index: parent_row,
    row: {
        delta_allocation: 2200,
        site_allocation: 2200
    }
});

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!