EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on July 26, 2022, 04:04:38 AM



Title: datagrid + set all values to a specific value
Post by: rezzonico on July 26, 2022, 04:04:38 AM
Hi all,

I need to write a javascript in order to set all values of the first column of a datagrid to a specific value.
I am able to loop throught a datagrid with "getRows", but how to modify the values ?

Thanks
Miche


Title: Re: datagrid + set all values to a specific value
Post by: jarry on July 27, 2022, 01:32:49 AM
The code below shows how to modify all the 'itemid' field values.
Code:
var dg = $('#dg');
var data = dg.datagrid('getData');
data.rows.forEach(row => {
row.itemid = row.itemid + ' new';
});
dg.datagrid('loadData', data);


Title: Re: datagrid + set all values to a specific value
Post by: rezzonico on August 19, 2022, 04:37:21 AM
Thanks !

Regards
Miche