EasyUI Forum

General Category => General Discussion => Topic started by: fmdano on December 29, 2022, 01:16:06 PM



Title: update datagrid cell text
Post by: fmdano 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


Title: Re: update datagrid cell text
Post by: jarry on December 30, 2022, 01:53:04 AM
If you are using the detail view extension, please set the 'autoUpdateDetail' property to false.


Title: Re: update datagrid cell text
Post by: fmdano 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.



Title: Re: update datagrid cell text
Post by: fmdano 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
    }
});