I'm trying to clear out my grid by setting the datasource to be empty. However, from what I've tried so far, I have issues when trying to initially set the datasource to empty, or when I try to add data back to my grid. It appears that you have to additionally set the "dataSourceType" to 'empty', but this presents other problems...
If I set the dataSourceType to empty:
$myGrid.igGrid('option', 'dataSourceType', 'empty');
$myGrid.igGrid('option', 'dataSource', []);
$myGrid.igGrid('databind');
This clears out my grid, but then, I use the addRow method to add rows back to this grid...
$myGrid.igGrid('addRow', {'employeeId', 5});
...and the dataSource of $myGrid is an empty array.
$myGrid.igGrid('options', 'dataSource') // empty array
I've tried setting the grid's datasource back to json before adding the row:
$myGrid.igGrid('option', 'dataSourceType', 'json');
...but still, the grid's dataSource is empty. Its like the rows are visually added, but the dataSource isn't updated.
Hello JoshNoe ,
From the sample it seemed that you were also using version 11.2 . Just the service release version seemed to be older(20112/1023).
Between service release versions there’re usually not many breaking changes as the service releases for a specific version only contain bug fixes.
Are there any specific issues you’ve encountered with the last Service release of 11.2? If so don’t hesitate to let me know.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Nevermind, I found a solution. I'll post it on here if I get some time.
Thanks Maya, but the newer versions have a bunch of breaking changes, and we can't afford to go back in and change our large codebase at this point. Do you have a hotfix for this bug?
This issue seems to be fixed in the latest service release version of 11.2: 11.2.20112.2205.
In that version the change in the data source is properly reflected. If you change the ig script reference to point to the latest SR:
<script src="http://cdn-na.infragistics.com/jquery/20112/2205/js/combined/min/ig.ui.min.js"
type="text/javascript"></script>
You sample should work as expected.
Let me know if you have any questions or concerns.
Hi Maya. Yes, autocommit is set to true, and I've tried calling the commit method manually. Neither make any difference. It appears that calling addRow, even with autocommit = true, does not add anything new to the dataSource of the grid, it only updates the display. Here's a simple example:
http://www.joshnoe.com/IgGridAddRow.html
Click the "Show Data" button at the bottom, and you'll see the current grid data. Then, click "Add Row", and a row will be added, and commit is called (autocommit is also set to true, so the commit call is redundant anyway). Next, click the "Show Data" button again. You'll see that the data was not added.