PDA

View Full Version : Error when trying to add only duplicates records to grid



MischaKroon
13 Jun 2010, 8:03 AM
This error happens in all browsers.

Tested with: extjs v3.1.1 / 3.2.1

When trying to add only duplicate records to a grid (through a jsondatastore) it tries to add an empty record to the grid which results in an error.

I have currently done a work around by adding a null check.
Am I doing something wrong or is this a bug?

Let me know if more information is required.



//build up each row's HTML
for (var j = 0, len = records.length; j < len; j++) {
record = records[j];
colBuffer = [];

if (record == null) return '';

var rowIndex = j + startRow;

evant
13 Jun 2010, 4:18 PM
You're not supposed to add duplicate records. Ids must be unique.

MischaKroon
13 Jun 2010, 11:20 PM
Same Issue was also reported here:
http://www.extjs.com/forum/showthread.php?93316-CLOSED-677-script-error-while-adding-duplicate-records-into-the-grid

It's wrong that this does work in a situation where there is a new item and doesn't work in a situation where there are only duplicates.

Short version according to me:
Works in situation 1, not in situation 2 -> Bug.

A fix is supplied in above code, I hope you will implement it or another fix.