This is a migrated thread and some comments may be shown as answers.

Script error with custom command button

5 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brian Roth
Top achievements
Rank 1
Brian Roth asked on 20 Jan 2011, 11:00 PM
I recently upgrade to the latest Telerik release and am getting a script error now on some custom commands that I have in the command toolbar.  I have traced through the error and figured out the cause, but wanted to find out if I am doing something wrong or if this is expected behavior.

The grid is an ajax-bound editable grid using a pop up edit form.  I'm not sure if that makes a difference or not.  What's happening is when I click on one of the buttons I get a  'closest(...).validate()' is null or not an object' script error in this code in the telerik.grid.editing.js file:

save: function (element, callback) {
    $(element).closest('form').validate().form() && callback();
},

This seems to be caused by the update row logic being fired off from the command button.  The command button is being automatically decorated with the t-grid-update class, which then causes the updateRow event to be hooked up due to this code:

.delegate('.t-grid-update', 'click', $t.stopAll(function (e) {
    grid.save(this, $.proxy(function () {
        grid.updateRow($(this).closest('form').closest('tr'));
    }, this));
}))

Should command buttons have the t-grid-update class?  Since they are outside of the actual grid, I don't understand how they could call updateRow properly.  Or am I doing something wrong in my setup?  I do have a call to preventDefault() in my code that runs in the onClick button event, but it seems like this save is taking place before my code event gets called.

Thanks for your help.  Please let me know if there's any more information I can provide.

Regards,
Brian

5 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 21 Jan 2011, 03:21 PM
Hi Brian,

Unfortunately I have to confirm that this behavior can be observed with the current version of our grid component. However, we were able to address this issue and the fix will be included with the next internal build, which will be available early next week. Meanwhile I have updated you telerik points as a token of gratitude for bringing this to our attention.

Regards,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rafael
Top achievements
Rank 1
answered on 27 Jan 2011, 04:40 PM
I have the same error
Is there some temporary workaround?
0
Georgi Krustev
Telerik team
answered on 27 Jan 2011, 05:05 PM
Hello,

 
The issue is related with server implementation of the custom command buttons. I have attached to modified files to this message. The files should be placed in Telerik.Web.Mvc/UI/Grid/ToolBar folder.

Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rafael
Top achievements
Rank 1
answered on 27 Jan 2011, 05:47 PM
Thanks so much for the help- it works
0
Hilda
Top achievements
Rank 1
answered on 14 Mar 2011, 09:58 AM
Hi Georgi,

I copied and pasted the files as told but it is still not working for me. Kindly help.

Regards,
Hilda Fabiola Bernard
Tags
Grid
Asked by
Brian Roth
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Rafael
Top achievements
Rank 1
Georgi Krustev
Telerik team
Hilda
Top achievements
Rank 1
Share this question
or