* Christof Donat <[EMAIL PROTECTED]> [2006-12-01 05:28]: > Hi, > > > > $('#grid').grid({data:data}).show().gridController().scrollToRow(6); > > > > An perhaps have a method that returns you back to jQuery object? > > Calling it 'end' (or any other jQuery method name) may be confusing, > > something like 'endGrid'. > > I don't think that is necessary. You could compare it to a call like > $('...').css('color'). That returns a string wich has methods like e.g. > substr() but no way to return to jQuery, because it is not necessary. You > almost always can move the call to gridController() to the end of your chain. > > Another way to solve the problem would be to use classes in the grid like > this: > > $('#grid').grid({data:data}).find('.row_42').scrollToView(); > > Then you just add methods like scrollToView() to the jQuery object which are > very usefull in other cases as well. Though I am not shure if you can do > everything the grid controller needs that way.
Christof You can't do everything that the grid controller needs, but some of the things that you do need, can be universal. Your suggestion takes advantage of the jQuery way, which is very DOM centric. It doesn't treat the DOM as "primitives", but a useful model. Tree structures, event bubbling, path langauges are powerfully expressive, they simply need to be made consistant across browsers. Thus, there are some ways in which a grid might have components that are grid abstractions, but also document the structure of the DOM that it generates so that programmers can add their own effects. $('#grid').grid({ data: data }) .gridController() .column(5).select().gridController() .jQuery() .find('.row_42').scrollIntoView().addClass('selected') Here's a "case study" to lead into a point. I came to jQuery looking for a way to create a grid control that did a grid and nothing but a grid. Other libraries had grid controls, with sortable, reorderable, resizable columns, with ajax updates, and in place editing, etc. I didn't want these things. I could turn them off, but I'd still have to download them, parse them, and step around them. What I wanted was a table that could scroll. If I didn't need the other features, I didn't want to pay for them. What I like about jQuery, is the potential to build more complicated objects from "primatives". With jQuery you don't hide DOM behind controllers the way you do in Prototype. jQuery is very DOM centric, which is good, because we still don't have the speed to afford ourselves too many abstractions. At the same time, the DOM is a pretty powerful abstraction, and probably doesn't need to be treated like gorey details. One programmer can create a simple grid renderer, but advertise what is rendered. Another programmer can whip up a smooth scroll into view, by attaching jQuery behaviors to the well-documented grid markup. -- 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/