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?
No, it only changes visible text, which gets reset with next post back.
set_text is completely cosmetic. For example, if the value is 5, you can use set_text() to set the cell text to "<img src='5.jpg'/>", or "There are 5 widgets in this product". It is completely disconnected from the value of the cell.
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
I meant to mention that previous javascript is called on exitededit on the cells of the grid. (along with other code)
Steve zelonis
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
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
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, ","); }