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.
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
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.
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
"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.
resolution here
http://es.infragistics.com/community/forums/p/86479/433008.aspx#433008
No resolution just found the cause. Its a compound question if you see the other links. I believe this issue and
http://es.infragistics.com/community/forums/p/86479/431759.aspx#431759
are related. The problem here is that any time I make a selection that includes a primary key column and change the data, all the cells data become blank for consecutive edits.
This problem is very difficult to give an example as I have a way to select multiple cells and would take a lot to replicate that. So I'm thinking it may be best to see that other bug first and hope this is fixed in the process.
The other link I provided was a fix for the issue of use infragistics without a primary hey. Long story short, our data is not connects to a database. We just display data on a screen. So the request to make infragistics work without the need of a primary key was brought up. A solution was presented but I'm afraid its buggy. Though this is just a guess...
Hi Sean,
Per your most recent post it appears that you have a resolution that will work for you. Let me know if that is not the situation or if you need further assistance.
Ok, the above method does work but there is one very strange thing going on here.Depending on my selections, once the data has been updated my next attempt to edit a cell returns "TypeError: rec is null" on line 35 on datasource.js". seems to be dependent on the data in the grid. Very small grid has no problems, data is update each time just fine. Large grids have the issue but its not always the same kind of selection. Most selection work just fine yet sections that include the last column seem to give this error. In all case the _data is correct after my first edit but I get that type error on any sequential edit in many cases.
{ edit }
I think I know the issue. If the primary key is in the selection it fails.
see this link it may be related. http://es.infragistics.com/community/forums/p/86479/431759.aspx#431759
also note this: http://es.infragistics.com/community/forums/p/85055/430952.aspx#430952
Per this fix I should be able to use the infragistics code without the primary key.
Duplicate post.