Categories | Question details Back To List | ||
Find and replace with SmartRenedering Hello, I am using pro version of grid v1.6. I am trying to implement a find and replace function. For example. I have a coilumn called Types and this lists various "Types". I have another part of the page where these Types can be edited, added and renamed. What I want to do is when a Type is remaned for the function to loop through the grid and replace the old name of the type with the new. I also have SmartRenedring switched on so I think using the forEachRow ablity would not work as it would force all the rows to be parsed? I can't see any other way of doing this? Is this possible? Also I have a select_filter on this column, how would I force that to also update to reflect the change. I am tryng to avoid reloading the grid. Many thanks Scott Bailey Answer posted by Support on Sep 01, 2008 05:50 >>Is this possible? var data = grid.findCell("old_value",index); for (var i=0; i<data.length; i++){ var id = data[i][0]; var index = data[i][1]; grid.cells(id,index).setValue("new_value") } >>I force that to also update to reflect the change grid.refreshFilters(); Answer posted on Sep 01, 2008 08:25 Hello, Thats fantastic works great. Is it possible to also edit the drop down in the background? These cells are coro and when cliked on the user gets a drop down of the types. so the XML behind it is like this. <cell xmlcontent="true"> So in the same loop as above can I changes these drop down options? Scott Bailey
Answer posted by Support on Sep 01, 2008 09:26 Please check http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Selectbox_collections.html#grid_art_selectbox There is no single API call for such task but can be done similar to next var combo = grid.getCombo("index"); var index = combo.values._dhx_find("old value"); // _dhx_find can be replaced with common loop search combo.values[index]="new value"; Such code will affect editor only, already selected data in rows, will not be changed |