We are using a alternative method for updates. Instead of using primary key we update the Dom element and then the respective JSON data.
var text = this.gridIDMap.cellAt( cell.index, cell.rowIndex ) text.innerHTML = d; //update jason var data = this.gridIDMap.dataSourceObject(); data[cell.rowIndex][cell.columnKey] = d
If I then double click on this changed data in the grid cell the old value appears as this was only a copy of the data. To fix that I must do a dataBind() to get my new copy data bound. Unfortunately this dataBind is very slow on our grids? So I was hoping to find a way to update the local directly DATA instead.
"Alternatively, you can update the private _data property directly which is basically the representation of your original data igDataSource consumes."
Well This works, but immediately gets changed back
alert( this.gridIDMap.dataSource._data[cell.rowIndex][cell.columnKey] )//shows the current value.this.gridIDMap.dataSource._data[cell.rowIndex][cell.columnKey] = d;alert( this.gridIDMap.dataSource._data[cell.rowIndex][cell.columnKey] ) //shows the updated value.
Then after edit is done, its back to the original? If it helps, I'm updating this data in edit mode.
Hello,
To update the data source of the grid directly you can use its public API described here: http://help.infragistics.com/jQuery/2013.2/ig.datasource . You can obtain the data source object the grid is bound to with:
$("#grid1").data("igGrid").dataSource
The methods for updating the data source do accept index as well as row ID if defined, however there is no setCellValue equivalent. You'll most likely need to use updateRow and pass as a parameter the whole updated record. Alternatively, you can update the private _data property directly which is basically the representation of your original data igDataSource consumes. This has the downside of bypassing the transaction log updates and therefore removing the ability to post local changes to the server automatically.
I hope this helps! Thank you for using Infragistics forums!
Best regards,
Stamen Stoychev
No this does not work out. Still getting the old data back once I reedit the cell. I'm looking for a way to update the cell data without needing to use dataBind or setCellValue. Need a quicker solution.
this.gridIDMap.cellAt( cell.index, cell.rowIndex ).innerHTML = myText //works ok for the on screen data but the JSON data needs to also be updated.
this.inIUDiv.igGrid( "option", "dataSource" )[cell.rowIndex][cell.columnKey] = myText//does not seem to work without using dataBind
as does
var data = this.gridIDMap.dataSourceObject(); //still need to use dataBinddata[cell.rowIndex][cell.columnKey] = myText
Any way to do this, local data should not take so long to edit a know position.
Is this permissible because it seems to work?
var text = this.gridIDMap.cellAt( cell.index, cell.rowIndex ) text.innerHTML = d; //update jason this.inIUDiv.igGrid( "option", "dataSource" )[cell.rowIndex][cell.columnKey] = d