Title: Datagrid problem on adding row multiple times Post by: iLLuSia on November 01, 2021, 04:58:34 PM Hello,
I have a datagrid: Code: $('#dg').datagrid({ And the function to add a row. It's supposed to add one right below the row, that has been clicked. Code: function addDatagridRow(index) { For example I have 3 rows with indexes: 1, 2, 3 And I add a row in the middle, the indexes are: 1, 2, 3, 3 The last row, although being in the 4th position, the formatter returns the value it has been initialized with. I'm sorry, I don't know how to better explain this. Is there a way to update the formatter, or the column? Or am I doing something wrong? Thank you in advance for any help. Title: Re: Datagrid problem on adding row multiple times Post by: jarry on November 01, 2021, 07:05:30 PM Please follow these steps to solve this issue.
1. Define the formatter function as: Code: formatter: function(value, row, index) { 2. Retrieve the 'index' value before insert a row. Code: function addDatagridRow(event) { Title: Re: Datagrid problem on adding row multiple times Post by: iLLuSia on November 01, 2021, 08:47:40 PM Thank you very much. This works perfectly.
|