Hi guys,
I'm using a checkbox grid inside a form and whenever I edit it, I want to automatically scroll down to the selected checkbox row, so I've come up with a jQuery script that picks up a class and scrolls down to it,
jQuery('html, body').animate({
scrollTop: jQuery('.defectComponentQuery table tr.k-state-selected:visible:first').offset().top
}, 1000);
/* .defectComponentQuery is the class of the Checkbox Grid, and since its a table, I've used table tr to single out the .k-state-selected class, as there might be other elements with the same class. */
Now, this works on JSFiddle, but I can't get it to work on AwareIM using the Render Script function, there's no error, it just doesn't work.
I've used $ instead of jQuery, no difference, I also created an HTML row and inserted the script in it, but then I get an error that says: 'Uncaught TypeError: Cannot read property 'top' of undefined' and the pop-up doesn't show up.
I'm using a modal pop-up as the editing window, any help would be appreciated, thank you for your time.
Here's the link to the JSFiddle: https://jsfiddle.net/2h6q4jav/