So I've analyzed a mark-up and here are some ways to handle the switch to quick edit mode.
First thing that I've tried was jquery selectors to find the "edit" link. I don't like this method because you can't sure that nobody will add an element on the page that will have the same class, attribute or even id. But it the case this approach doesn't work anyway because there is no any specific class or attribute you can use to find the elements by selector correctly.
Then I've dug a little bit deeper. The onclick handler for the "edit" link looks like that:
So maybe I can just change the EnsureScriptParams function to add some custom code (Thanks to Brendan Eich that we can do that in javascript). But unfortunately this function is used in many cases to ensure that some script is loaded and the function exists.
In case of "Edit" link it used to ensure inplview script and InitGridFromView function.
This is it! The solution is to change the InitGridFromView. This function will be called when any list on the page is switched to the quick edit mode.
So the result code is simple (one more thanks to Brendan):
Have fun!
Comments