[Phpmyadmin-devel] AJAXify phpMyAdmin Interface - GSOC 2011 - Table->Structure ->Column->Change

Rouslan Placella rouslan at placella.com
Fri Jul 15 19:30:35 CEST 2011


On Fri, 2011-07-15 at 20:51 +0530, Thilanka Kaushalya wrote:
> Hi Marc,
> 
> I remember mentioning this before, but you must have forgotten about it.
> > >From what I can see, in all parts of your project you have left
> > footnotes in your ajax dialogs, instead of converting them to tooltips.
> > Please find attached a screenshot that shows the difference between one
> > and the other. If you want to use tooltips (I think it's a good idea),
> > then you will have to convert the footnotes right after you show your
> > ajax dialog to the user, the function that does the conversion is called
> > initTooltips() and it resides inside functions.js. However, after a
> > quick glance at that function, it looks to me like it needs to be
> > modified a small bit. Right now it looks for elements across the whole
> > of the DOM, but it would be better to be able to pass to it an optional
> > jQuery object as a parameter, so that it is possible to make it look for
> > footnotes and the respective markers inside a particular object only.
> > Hope this helps :)
> >
> >
> If I change the initTooltips() function by adding a jquery object parameter
> to it, it will be effect to the places where this function is already used.

Not necessarily. Recall that JavaScript does not care about missing
input parameters for functions, it just treats them as undefined. You
can exploit this to make the new parameter optional. An example would
be:

----->%-----
function myFunction($obj)
{
    if ($obj == undefined
        || ! $obj instanceof jQuery
        || $obj.length == 0
    ) {
        // input was invalid, so we
        // operate on the whole document
        $obj = $('body');
    }

    $obj.find('#someID').doSomething();
}
----->%-----

This will allow you to leave alone all the calls to initTooltips() that
are already in the code base (and that have no arguments). Hope this
makes sense.

Bye,
Rouslan





More information about the Developers mailing list