jQWidgets Forums
jQuery UI Widgets › Forums › Grid › addrow method call many time
This topic contains 2 replies, has 2 voices, and was last updated by viom 7 years, 1 month ago.
Viewing 3 posts - 1 through 3 (of 3 total)
-
Author
-
i use version 5.4.0,
only call once that “addrow”, it’s work well.
but i call “addrow” method many time using for loop
Grid’s view appear only last one and other cell is appear only white color.
Can I see why?var addObject = new Object(); addObject.lockId = lockId; addObject.dongle_subtotalPrice = dongle_subtotalPrice; addObject.productPrice = productPrice; for (var i = 0; i < 10; i++) { $("#ScheduledOrderGrid").jqxGrid('addrow', null, addObject, 'last'); } function SetScheduledOrderGrid(result) { var source = { localdata: result, datatype: "json", datafields: [ { name: 'lockId' }, { name: 'dongle_subtotalPrice', type: "number" }, { name: 'productPrice' } ] }; var dataAdapter = new $.jqx.dataAdapter(source, { loadComplete: function (data) { }, loadError: function (xhr, status, error) { } }); var imagerenderer = function (row, datafield, value) { return '<img style="margin-left: 5px;width:100%;height:100%;cursor:pointer;padding:5px 5px 5px 0px" src="/Resources/icon/svg/trash.svg" onclick="ScheduledOrderGridClick(' + row + ')"/>'; } $("#ScheduledOrderGrid").jqxGrid({ source: dataAdapter, width: '100%', editable: true, //pageable: true, //pagermode: "simple", showaggregates: true, showstatusbar: true, statusbarheight: 25, autoheight: true, columns: [ { text: 'productPrice', datafield: 'productPrice', hidden: true }, { text: '#', sortable: false, filterable: false, editable: false, groupable: false, draggable: false, resizable: false, align: 'center', cellsalign: 'center', datafield: '', columntype: 'number', width: '10%', cellsrenderer: function (row, column, value) { return "<div style='margin:4px;'>" + (value + 1) + "</div>"; } }, { text: 'Dongle', datafield: 'lockId', width: '35%', align: 'center' }, { text: 'Price', datafield: 'dongle_subtotalPrice', width: '45%', align: 'center', cellsalign: 'right', cellsformat: 'd2', columntype: 'numberinput', //aggregates: ['sum'], aggregates: [{ '<b>Total</b>': function (aggregatedValue, currentValue, column, record) { var total = currentValue; return aggregatedValue + total; } }], validation: function (cell, value) { //if (value < 0 || value > 15) { // return { result: false, message: "Price should be in the 0-15 interval" }; //} return true; }, initeditor: function (row, cellvalue, editor) { editor.jqxNumberInput({ digits: 20, max: 99999999999999999 }); } //, cellbeginedit: cellbeginedit, cellsrenderer: cellsrenderer }, { text: '', datafield: 'Delete', width: '10%', editable: false, cellsrenderer: imagerenderer } ] }); }
Hello viom,
Here is an example based on Observable Array: Link
Best Regards,
StanislavjQWidgets Team
http://www.jqwidgets.com/Thanks. Work well now
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.