-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default field implementations don't pass the backing data item through template functions #466
Comments
Are you sure this is the case? It doesn't matter that |
I apologize for leaving out a crucial bit of information - this only happens if I create a custom I have created a simple example to showcase the problem: JSFiddle. Toggle the row edit and you'll see. EDIT: After re-reading your answer, yes, that's the workaround I've implemented right now but my original scenario, like the fiddle I linked, was without the |
Now I see. Yes, you are right. But the base field doesn't support editing, that's why it just calls I agree this could be reasonable to render Let me know, what you think. |
I don't see how that can be a breaking change considering that it already works like that, snippet from SelectField again: editTemplate: function(value) {
if(!this.editing)
return this.itemTemplate(value);
//rest of the code
} The only change I propose is that the item is also passed through: editTemplate: function(value, item /*just like in base Field */) {
if(!this.editing)
return this.itemTemplate(value, item /* just like in base Field */);
//rest of the code
} But, obviously, it's totally up to you. I have it working by overriding |
I just ran into this issue as I wanted to adjust the item template based on a piece of data. So in the example below this field has editing off but if my However it did work after I added the overridden editTemplate that tonisostrat suggested which seemed strange as I wasn't even using editing for that column. Anyway thanks for the work around tonisostrat.
|
@tonisostrat, ah, now I see. I thought you are proposing to put this logic (fallback to |
Looking at the core Field,
editTemplate
function is defined as:which is all well and good.
However, all the concrete fields extending from it override that function and discard the
item
object. Following example is from SelectField:This means if I have a "perfect storm" combination where a field is non-editable and references other
item
properties to renderitemTemplate()
it will break the row-editing functionality becauseitem = undefined
.The text was updated successfully, but these errors were encountered: