Save data Item changes

Posted by: bmakhlin on 18 September 2018, 11:50 am EST

    • Post Options:
    • Link

    Posted 18 September 2018, 11:50 am EST

    I have FlexGrid with radio buttons in its cells. On radio button change I am modifying dataItem property that is NOT bound to the grid. The problem is the value of that property is not stored in the grid. How do I make FlexGrid to retain the value of the modified dataItem property?

    Below is function that set property value of dataItem. When I select radio button in column 1 of the grid updateDataItem method gets called and it logs the following output to the console.

    row 0 column 1 value true

    (2) row 0 column 1 value false

    After iterating the first row the column1 value is set to correct value of. After iteration continues to second and third row the column1 value get set to initial value of false.

    Why does not grid retain the value and changing it to false? I tried using beginUpdate and endUpdate but that did not work. What do I need to do to make grid retain the value set on dataItem property?

    
          updateDataItem(flexGrid) {
            flexGrid.rows.forEach((row, rowIndex) => {
                for (let columnIndex = 1; columnIndex < flexGrid.columnHeaders.columns.length; columnIndex++) {
                    const match = row.dataItem['column' + columnIndex].id === row.dataItem.column0.selectedId;
                    row.dataItem['column' + columnIndex].value = match;
                }
                console.log('row 0 column 1 value ' + flexGrid.rows[0].dataItem.column1.value);
            });
            return [];
        }
    
    

    thank you

  • Posted 19 September 2018, 1:35 am EST

    Hi,

    If we understand correctly then you have radio buttons in grid cells and when the value of radio button changes you are modifying the dataItem for the row but somehow the changes are not retained in the grid.

    We tried to create a similar use case and we were able to modify the dataItem values correctly. Could you please have a look at the following sample and let us know what we need to change in the sample to replicate the issue or you may also update the sample to replicate the issue.

    https://stackblitz.com/edit/angular-fezpvp?file=src%2Fapp%2Fapp.component.ts

    Regards

    Sharad

  • Posted 20 September 2018, 12:18 pm EST

    thank you very much. I helped to find the problem unrelated to the Flex Grid.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels