jQWidgets Forums
jQuery UI Widgets › Forums › Getting Started › rowdata.value
Tagged: aggregates, angular grid, cell data, cellsrenderer, combine, concatenate, data, grid, jquery grid, jqxgrid, rowdata
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 9 years ago.
-
Authorrowdata.value Posts
-
Hello,
The code in question:text: ‘Total’, editable: false, datafield: ‘total’,
cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
var total = parseFloat(rowdata.price) * parseFloat(rowdata.quantity);
return “<div style=’margin: 4px;’ class=’jqx-right-align’>” + dataAdapter.formatNumber(total, “c2”) + “</div>”;
}
}you can put in some rowdata.”value” that includes all the values of the cells?
I have a grid with 31 row (calendar) becomes difficult I add up all the 31 row writing rowdata.data1 + rowdata.data2 + rowdata.data3 etc etc…in addition, for each row I insert a character that should correspond to a value, for example :
if (rowdata.”value” == “M”){ return + 7.12};
if (rowdata.”value” == “P”){ return + 7.52};
if (rowdata.”value” == “N”){ return + 8.65};I hope I was clear, I await answer, Charles.
Hello cereale,
Thank you for the suggestion. Please note that rowdata contains the data of all the cells in a row, not of all the rows in a grid. You can try the following solution to quickly concatenate all cell values:
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { var allCellsValues = ''; for (var cell in rowdata) { allCellsValues += rowdata[cell]; } //... }
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thanks, in fact, I would like to calculate the values of each line and give, for each one, the result in the Total row, the difference is that in each cell there is a number, but a character, essentially are three M, P, N, for each of the characters matches a value, if the input character is different from the three the value is null. Nellla line indicates the total must give me the sum total.
Excuse my little jquery experience, I know php and mysql enough. The code that you sent me I can not put it into practice …I have little experience … you can give me an example more explicit? I would be very grateful ….. Carlo.
Hi Carlo,
I think you may be looking for the aggregates functionality. Please take a look at the following related demos:
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.