[Phpmyadmin-devel] About the AJAXification of the index editor
Marc Delisle
marc at infomarc.info
Wed Jul 6 18:37:25 CEST 2011
Le 2011-07-06 10:38, Thilanka Kaushalya a écrit :
> Hi Marc and Rouslan,
>
>
> You filed bug #3350790 on the tracker, which I looked into and fixed
> earlier. This also gave me a chance to look at the AJAXification of the
> index editor, which as I can see from your blog you have deemed
> completed. Anyway, I found some issues in your implementation and
> thought you might want to know about them.
>
> First, the JS errors from bug #3350790 are gone, but the functionality
> from checkIndexName() function in indexes.js only works in the QA_3_4
> branch. This is due to the AJAXification that you did. That function was
> written in plain JS, when there was no jQuery or AJAX. Line 44 in that
> file should have been a dead giveaway that the function was about to
> break (onload = checkIndexName;), since a browser does not fire an
> onload event for AJAX requests. Anyway, I think that the
> checkIndexName() function should be rewritten in jQuery and then called
> inside the AJAX request from tbl_structure.js. Also there is some inline
> JS in tbl_indexes.php, which you may want to rewrite in jQuery if you
> will be rewriting checkIndexName().
>
>
> I used to call this checkIndexName() function within my
> "*$("#table_index tbody tr td.edit_index.ajax").live('click')*" event in
> tbl_structure.js file after getting the form loaded in the dialog. Then
> it runs at as the "onload" in non ajax scenario. Is it okay to handle
> that or should I rewrite the function for ajax.
Thilanka,
as Rouslan said, please rewrite this function in jQuery, probably
passing to it the form name as a parameter. Then move it to js/functions.js.
Then you'll be able to call it from tbl_structure.js in your Ajax logic;
you'll be able to call this function also from indexes.js at load time.
Finally in tbl_indexes.php, instead on the "onchange", use jQuery in
indexes.js to bind to changes in select_index_type.
--
Marc Delisle
http://infomarc.info
More information about the Developers
mailing list