I'm still having to reapply this patch after every update. Shouldn't the afterInsertRow handler run *after* the row is inserted, not before?
Am I misunderstanding something? Isn't it a bug that the afterInsertRow handler is run before the row data is inserted?
I'm having a possibly related problem, using the current version from github. I get “Cannot set property 'name' of undefined” in grid.base.js line 2957.
The problem occurs when I use setCell() within an afterInsertRow handler. Looking at the code in grid.base.js for addRowData(), it seems to be calling the afterInsertRow handler before it actually inserts the data.
In $.unformat(), if unformatFunc is undefined and there's no formatter in the colmodel, then it ends up returning (line 419 of jquery.fmatter.js):
cnt===true ? $(cellval).text() : $(cellval).html();
I'm not sure what cnt means (though it will be false when coming from getRowData), but in any case there's no special handling (as in htmlDecode) to convert ' ' to ''.
It looks like the first (cellval) argument of $.unformat() was changed from a string to a jQuery object or something, but not all the places where it is called have been updated. I guess it still works as long as the cell contents can be recognized by jQuery as an HTML fragment, but that's not usually going to be the case. It works for a select, which is probably what Tony's been working on most recently, but not for '' or 'foo', for example, and cell values like 'input' or 'body' are going to really mess things up. And I've been getting warnings when I have cells containing characters like '/' and '!' that are invalid in selectors.
I'm not sure what the fix is, but the first argument probably needs to be either the jQuery object corresponding to the cell (or maybe the DOM object), in which case it shouldn't be called “cellval”, or a string with the contents of the cell, in which case $.unformat() needs to handle it differently.
Ah, yes. I forgot to specify the version. It's from Github.
That's fine for text, password, and textarea because you can avoid it by setting size or cols. But for select there needs to be a way to avoid setting the width to 98% or 99% or whatever is decided. I'd prefer not having that happen at all, just leave them at the width the browser gives them (based on the width of the options), and let people set it to 99% in the stylesheet if that's what they want.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top