In a webdatagrid, what is the different of these two functions when a cell value is changed or edited?
set_text() only changes HTML text of the TD, it does not affect cell's value and does not create a transaction to update data source. set_value() does all of these.
If i use set_text(), does it get commited on a client side behavior commit?
Any suggestions on why when using set_text I do lose my value (doing a get_value right after returns 0). I am just trying to set negative values to (number). Which I have done in 2 grids my 3rd grid seems to set teh value to 0 (guessing because it cant translate (number) to a value. I am using version 11.2. binding to class that has null-able integers as their values.
Any suggestions would be great
Steve zelonis
Sorry my javascript looks as such:
var cell = evntArgs.getCell(); var colName = cell.get_column().get_key(); var r = cell._row._address; var c = cell._address; // Foramt text of current cell var colval = webDataGrid.get_rows().get_row(r).get_cell(c).get_value(); //alert(webDataGrid.get_rows().get_row(r).get_cell(c).get_value()); //debugger; if (colval < 0) { var scolval = String(Math.abs(colval)); webDataGrid.get_rows().get_row(r).get_cell(c).set_text("<font color=" + String.fromCharCode(32) + "red" + String.fromCharCode(32) + ">(" + numberWithCommas(scolval) + ")</font>"); //webDataGrid.get_rows().get_row(r).get_cell(c).set_text(numberWithCommas(scolval)); } else { var scolval = String(colval); webDataGrid.get_rows().get_row(r).get_cell(c).set_text(numberWithCommas(scolval)); }function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }
Hi,
In most cases, the value is extracted from the html of the cell, unless it was formatted on the server. What you should do is call set_value(colVal, newText); This will keep the old value in an attribute on the cell and replace the text.
regards,
David Young
I don't want to change the value I actually use that to calculate other row/columns they just want to see any negative numbers displayed as (num) Ie. -99 would have text of (99)
Steve Zelonis
I meant to mention that previous javascript is called on exitededit on the cells of the grid. (along with other code)
I realize this is an older post, but it seemed the best context to ask this question. Where do I find documentation on set_value(), set_text() and other functions? I could not find them anywhere in the Infragistics documentation. I am pretty good at web forms, but asp.net is new to me and I would never have known of these methods without this post, so can you offer a good resource to educate me on the available methods/functions?
Thanks!
Mark