* Brian Miller <[EMAIL PROTECTED]> [2006-12-01 09:05]: > > Hi, > > > >> Controller set of methods is returned.. > >> > >> $('#grid').grid().data(data).drig().show() > >> $('#grid').grid().scrollToRow(6).drig().css("border", "1px") > >> > >> A controller object is returned.. > >> > >> var grid = null > >> $("grid").grid({ > >> data: data, > >> onComplete: function(controller) { grid = controller } > >> }) > >> grid.srollToRow(6) > >> > >> What is best practice? > > > > How about the Idea to have a jQuery-function that returns the controller > > object: > > > > $('#grid').grid({data:data}).show().gridController().scrollToRow(6); > > > > That way the function that creates the grid does not break the chain, but > > there is a function that returns a controller object. You don't > > necessarily > > need a way to come back to jQuery if you do it that way, because you can > > chose to get the controller Object later in the queue. > > > > You should think if you want a controller object that can handle mutliple > > grids at the same time: > > > > $('.allmygrids').grid({data:data}).show().gridController().scrollToRow(6); > > > > If not, then gridController() needs to take a parameter to know which of > > the > > grids you mean: > > > > $('.allmygrids').grid({data:data}).show().gridController(42).scrollToRow(6);
> How about overriding $.end() in the grid plugin, so that it returns the > original jquery object if it's run on the grid controller? > > Of course, you'd have to remember to make $.end() behave normally if run > elsewhere. Or, you could just create an $.endGrid() function for the > controller, and not worry about messing with $end() at all. I'm now growing partial to this convention... $("div.grid").grid() .data(gridData). .columns(2, 3, 7) .select() .sortable() .grid() .rowHeight(22) .jQuery() .show() .css("width", "500px) Which is where you return control by naming the object that you wish to recover. -- Alan Gutierrez - 504 717 1428 - [EMAIL PROTECTED] - http://blogometer.com/ Think New Orleans - http://thinknola.com/ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/