Closed khoying closed 11 years ago
Can you provide a reduced test case, or at least show us the column structure of your grid? Otherwise we can only guess as to how to reproduce this (for example, I'm not seeing an issue like this in dgrid/test/performance_widgets.html
).
Thank you for the quick response.
I actually do have a rather complicated editor that I am using and the problem is definitely with it. If I do not include the it then everything works fine. The issue is also very reproducible in that it initially works until I get to row 100, I believe, then it starts throwing the error.
I tried to replace my complicated editor with a simple button or field but for some reason that will not work at all. My grid data does not show at all if I do that. Frustrating! Do you happen to have an example of a Button editor that I can try to include as a column and see what happens?
Thanks, Ken
From: Kenneth G. Franqueiro [mailto:notifications@github.com] Sent: Tuesday, April 23, 2013 10:08 AM To: SitePen/dgrid Cc: Hoying, Ken Subject: Re: [dgrid] Dgrid[0.3.6] TypeError: row is undefined (#557)
Can you provide a reduced test case, or at least show us the column structure of your grid? Otherwise we can only guess as to how to reproduce this (for example, I'm not seeing an issue like this in dgrid/test/performance_widgets.html).
— Reply to this email directly or view it on GitHubhttps://github.com/SitePen/dgrid/issues/557#issuecomment-16860053.
***Note:The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the Sender immediately by replying to the message and deleting it from your computer. Thank you. Premier Inc.
I changed my code to use a column with renderCell as opposed to editor. This fixed my issue.. sort of… I can now scroll to my heart is content and no longer get the error. However, I think I need to clean these widgets up on my own. Is that true? So I added the following aspect:
aspect.before(this.grid, "removeRow", function(rowElement){
var cellElement = self.grid.cell(rowElement, self.actionsColumnId).element;
array.forEach(registry.findWidgets(cellElement), function(widget, index) {
if(widget){ widget.destroyRecursive();}
});
});
This results in exactly the same issue that I am having when using the editor. After awhile I get the same TypeError at the same spot.
I did notice something that that I think is important and probably what is causing the error itself to happen but I am not sure what the root cause. is. I noticed that when things are working initially the target that is getting passed to the cell function looks like this “div#grid_10004-row-88550.ui-state-default”. However when it stops working and starts throwing errors the target that is getting passed to the cell function looks like this “div#grid_10004.ui-widget”.
Thanks, Ken
From: Kenneth G. Franqueiro [mailto:notifications@github.com] Sent: Tuesday, April 23, 2013 10:08 AM To: SitePen/dgrid Cc: Hoying, Ken Subject: Re: [dgrid] Dgrid[0.3.6] TypeError: row is undefined (#557)
Can you provide a reduced test case, or at least show us the column structure of your grid? Otherwise we can only guess as to how to reproduce this (for example, I'm not seeing an issue like this in dgrid/test/performance_widgets.html).
— Reply to this email directly or view it on GitHubhttps://github.com/SitePen/dgrid/issues/557#issuecomment-16860053.
***Note:The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the Sender immediately by replying to the message and deleting it from your computer. Thank you. Premier Inc.
The fact that you're seeing div#grid_10004.ui-widget
passed to the cell function does indeed seem odd, as that looks like it'd be the grid's domNode
, not a specific cell's node at all. However, it's still not feasible for us to resolve this without having steps or an example to reproduce it. Can you use a debugger that allows you to break on errors and trace the stack at the time the error occurs, and see if it helps you identify anything either in dgrid or your own code? Perhaps it'd help lead to a reduced test case as well.
Hi,
I'm hitting this same error intermittently, with a different setup, which might be possible to create a test case (though a bit of setup). Should have more data to confirm or refute my theory.
In my case, this has to do with updating data in a row that has two alwaysOn, autoSave editors on it, when the row's height is taller than the minimum. The dgrid is backed with an Observable MemoryStore
What appears to happen is that when you update the data in one of the editors, it does a store.put() with the item. This triggers the aspect code and dgrid removes the row and generates the new row. When the row is normal height, this works absolutely fine. However, when data in a non-editor column is long enough to wrap, it makes the height taller, and for some reason when the replacement row is generated, it's set to display:none and the other editor is not yet created when dgrid tries to update it.
It then triggers the same exact behavior, attempting to load a cell with a target of the domNode of the grid instead of the editor widget, and fails from there.
In my application, these do happen to be subrows using tree(), but I'm thinking that's not causing the issue.
Here's what my columns look like:
columns: {
task: tree({label: 'Case', shouldExpand: function(){ return true; }}),
status: 'Status',
entry_date: 'Date',
user_id: 'Person',
budget: 'Budgeted',
actual: 'Actual',
notes: 'Notes',
approved: editor({
label: 'Approved',
renderCell: myObj.renderApproved,
canEdit: myObj.canEdit,
autoSave: true,
get: function(object) {
if (!object.approved) {
return 0;
}
return object.approved*1;
},
editorArgs:{
constraints:{min: 0},
smallDelta: 0.25,
largeDelta: 0.75,
maxLength:4,
intermediateChanges: true
}
}, NumberSpinner
),
skip: editor({
label: 'Skip?',
editor: CheckBox,
autoSave: true,
get: function(object){
if (object.type == 'time_entry'){
return object.confirmed == 0 ? 'Unconfirmed':object.skip;
}
return null;
},
canEdit: function(object){
return object.type == 'time_entry' && object.confirmed>0;
}
})
So with this, everything works fine, most of the time, until we hit a case where both approved and skip are enabled editors, AND the "notes" column has content that wraps and forces the line height to be higher than the minimum. Then any change to the data in the row, either from one of the editors or through other interaction with the store, causes the same error as khoyang is getting.
.... aaaand, that's not the source of the problem. Still stumped -- I'm now finding, with fresh data, cases that fit my described scenario but do not trigger the bug. It's definitely a bug, and I think it's basically a race condition, but I'm having a hard time figuring out what exactly is triggering it.
I still have one row of data that is triggering it, but when I tried setting up another set of data with the same row heights, mostly same other conditions, that row does not trigger the bug and everything works fine. The original row, meanwhile, still triggers it. I can't see what's different about them.
It occurs to me that this might be related to #195. We just tagged dgrid 0.3.9 with a fix for that, so could you try updating your dgrid package and testing again?
I don't think the fix for #195 completely fixed this issue. My setup is a bit simpler that the grids mentioned here. The grid is an OnDemandGrid mixed with Selection and ColumnResizer. The grid is backed by a JSON store wrapped with Cached (with Memory as a secondary store) and Observable. The total number of items in my test is 5000. Before upgrading with the fix, I was getting many error messages and sections of the grid were not updating. Now the sections appears to be updating even with fast scrolling. However fast scrolling still causes the error to happen once, though once it happens I cannot make it happen again by doing more scrolling like I could before the update.
Columns:
columns:{
selected:editor({
label:" ",
autoSave:true,
sortable:false
}, "checkbox"),
name:{
label:"Name"
},
dateCreated:{
label:"Date Created",
get: function(item){
var dateString = item.dateCreated;
var date= stamp.fromISOString(dateString);
return dateLocale.format(date, {
selector: "date",
formatLength: "short"
});
}
},
date1:editor({
editor:DateTextBox,
editorArgs: {selector: 'date', datePattern: 'yy-mm-dd', locale: 'en-us', style: "width: 125px"},
label:"Date",
sortable: true,
autoSave: true
}),
next:editor({
label:"Next",
autoSave:true,
sortable:false
}, "checkbox"),
complete:editor({
label:"Complete",
autoSave:true,
sortable:true
}, "checkbox")
}
Hi @gewthen,
I've tried reproducing the issue using your column structure above, combined with the rest.php used for test/JsonRest.html (increasing it to 5000 rows), but haven't been able to see an error. Here are some thoughts to try to narrow it down:
cell
method) as the one originally reported in this issue? Can you provide a stack trace?I realize several people have reported issues in this thread, but without further information we've been unable to reproduce the issue. As such, I'm closing this for now, but if any of you are still experiencing the issue with dgrid 0.3.11 and can provide more information, we can try again.
I am getting errors with my OnDemandGrid if I scroll to fast while using an editor that is a widget in one of the columns. I am getting the error TypeError: row is undefined in the cell function on line 58:
var row = this.row(target), rowElement = row.element;
We are getting ready to roll out our application and this could become a show stopper for us. Any help would be GREATLY appreciated!!!
Thanks in advance! Ken