jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Error editing last time of grouped grid
This topic contains 5 replies, has 3 voices, and was last updated by przemo 11 years, 9 months ago.
-
Author
-
Using the following example, when I edit the quantity of the last row, the following error is reported:
TypeError: L is null
L[y] = D;Grid populated from Array.
$(document).ready(function () {
// prepare the data
var data = new Array();
var generatedata = function (rowscount) {
var firstNames =
[
“Andrew”, “Nancy”, “Shelley”, “Regina”, “Yoshi”, “Antoni”, “Mayumi”, “Ian”, “Peter”, “Lars”, “Petra”, “Martin”, “Sven”, “Elio”, “Beate”, “Cheryl”, “Michael”, “Guylene”
];
var lastNames =
[
“Fuller”
];
var productNames =
[
“Black Tea”, “Green Tea”, “Caffe Espresso”, “Doubleshot Espresso”, “Caffe Latte”, “White Chocolate Mocha”, “Cramel Latte”, “Caffe Americano”, “Cappuccino”, “Espresso Truffle”, “Espresso con Panna”, “Peppermint Mocha Twist”
];
var priceValues =
[
“2.25”, “1.5”, “3.0”, “3.3”, “4.5”, “3.6”, “3.8”, “2.5”, “5.0”, “1.75”, “3.25”, “4.0”
];
for (var i = 0; i < rowscount; i++) {
var row = {};
var productindex = Math.floor(Math.random() * productNames.length);
var price = parseFloat(priceValues[productindex]);
var quantity = 1 + Math.round(Math.random() * 10);
row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
row["productname"] = productNames[productindex];
row["price"] = price;
row["quantity"] = quantity;
row["total"] = price * quantity;
data[i] = row;
}
return data;
}
var source =
{
localdata: generatedata(2),
datatype: "array"
};
var dataAdapter = new $.jqx.dataAdapter(source, {
downloadComplete: function (data, status, xhr) { },
loadComplete: function (data) { },
loadError: function (xhr, status, error) { }
});
$("#jqxgrid").jqxGrid(
{
width: 670,
source: dataAdapter,
editable: true,
groupable: true,
columns: [
{ text: 'First Name', datafield: 'firstname', width: 100 },
{ text: 'Last Name', datafield: 'lastname', width: 100 },
{ text: 'Product', datafield: 'productname', width: 180 },
{ text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
{ text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
{ text: 'Total', datafield: 'total', width: 100, cellsalign: 'right', cellsformat: 'c2' }
],
groups: ['lastname'],
});
// refresh Grid data.
$('input').click(function () {
source.localdata = generatedata(50);
$("#jqxgrid").jqxGrid({ source: source });
});
});Hi timo,
We cannot reproduce that using jQWidgets 3.0.2 and the provided code.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI beautified the jqxgrid.js minimized file to look into the issue I’m having.
In the following code snippet starting on line 6579:var g = this.getrowvisibleindex(d);
if (g >= 0 && g < this.dataview.bounditems.length) {
…
}
return nullthis.getrowvisibleindex(d) returns 2
this.dataview.bounditems.length returns 2Therefore getrenderedrowdata returns null, resulting in the error I reported.
Please advise.
Hi timo,
As I already written, there is no such behavior with the current version.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comAs I already written, there is no such behavior with the current version.
There is…
In groupsrenderer.html example add editable: true to jqxGrid definition.
This problem occurs when you try to edit last Quantity field in the last group:
In Firefox:TypeError: L is null
Chrome:
Uncaught TypeError: Cannot set property 'quantity' of null
Ok, in 3.0.3 release it works
-
AuthorPosts
You must be logged in to reply to this topic.