javascript - Totalling an ExtJS editable grid's input fields -
this question regards extjs 3 editable grids. have need total input fields of 1 column of editable grid. there the store's sum method data in input fields not in store; instance might make entry in input field , click button on toolbar.
the "traditional" way in case seems to set appropriate listener , commit content of input field store, can convoluted , seems downright unnecessary if result of clicking toolbar button re-directed elsewhere anyway. there solution?
an alternative gather input fields using oft-overlooked ext.query functionality; following second column of grid ('.x-grid-col-0' first column):
var qtyfields = ext.query('.x-grid3-col-1 input', mygrid.getview().mainbody.dom); var total = 0; var qty; (var i=0, n=qtyfields.length; i<n; i++) { qty = parsefloat(qtyfields[i].value); total += isnan(qty) ? 0 : qty; }
Comments
Post a Comment