Re: [jQuery] Designing for reuse

2006-12-02 Thread Christof Donat
Hi, > // imagine yourself some code in these functions. > [...] > > Event.observe($("#switch"), 'click', switchViews) I like that. In jQuery-style it could be something like this: jQuery('#switch').bind('click',function() { var showme = jQuery.treeView('#mytree'); var hideme = jQ

Re: [jQuery] Designing for reuse

2006-12-02 Thread Jörn Zaefferer
Alan Gutierrez schrieb: > I'm now growing partial to this convention... > > $("div.grid").grid() > .data(gridData). > .columns(2, 3, 7) > .select() > .sortable() > .grid() > .rowHeight(22)

Re: [jQuery] Designing for reuse

2006-12-02 Thread Jörn Zaefferer
Hi Alan! > Thus, jQuery can take the controller centric model and make it lot > more powerful. > It would be really great if you could put an example showing what you described here. Something to click trough to see it in action. -- Jörn Zaefferer http://bassistance.de

Re: [jQuery] Designing for reuse

2006-12-01 Thread Alan Gutierrez
* 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, > > somethi

Re: [jQuery] Designing for reuse

2006-12-01 Thread Alan Gutierrez
* 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 = nul

Re: [jQuery] Designing for reuse

2006-12-01 Thread Alan Gutierrez
* Brandon Aaron <[EMAIL PROTECTED]> [2006-12-01 10:16]: > On 12/1/06, Sam Collett <[EMAIL PROTECTED]> wrote: > > 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

Re: [jQuery] Designing for reuse

2006-12-01 Thread Alan Gutierrez
I'm fond of the elegance of chaining for manipulating the DOM. The chaining methods of jQuery operate on a set of items and as someone who's landed and getting used to the library and it's idioms the ability to act on all the elements that match a pattern accurately models how I view markup. $('d

Re: [jQuery] Designing for reuse

2006-12-01 Thread Sam Collett
On 01/12/06, Brandon Aaron <[EMAIL PROTECTED]> wrote: > If this type of functionality starts to be > required I would suggest including a standard way for plugins to > easily restore state (.end()) in the core. Destructive methods will be > no more in 1.1, so I don't think .end() will be around eit

Re: [jQuery] Designing for reuse

2006-12-01 Thread Brandon Aaron
On 12/1/06, Sam Collett <[EMAIL PROTECTED]> wrote: > 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 using .end() would be confusing. If it makes sense for a plugin to

Re: [jQuery] Designing for reuse

2006-12-01 Thread Brian Miller
Heh, I should have read this first, before suggesting it myself. *blush* - Brian > On 01/12/06, Christof Donat <[EMAIL PROTECTED]> wrote: >> Hi, >> >> > Controller set of methods is returned.. >> > >> > $('#grid').grid().data(data).drig().show() >> > $('#grid').grid().scrollToRow(6).drig().css("

Re: [jQuery] Designing for reuse

2006-12-01 Thread Brian Miller
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 worr

Re: [jQuery] Designing for reuse

2006-12-01 Thread Christof Donat
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

Re: [jQuery] Designing for reuse

2006-12-01 Thread Sam Collett
On 01/12/06, Christof Donat <[EMAIL PROTECTED]> wrote: > 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 > > $("gri

Re: [jQuery] Designing for reuse

2006-12-01 Thread Christof Donat
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

Re: [jQuery] Designing for reuse

2006-11-30 Thread Alan Gutierrez
* Dave Methvin <[EMAIL PROTECTED]> [2006-11-30 17:10]: > This will be a short thread--NOT! :-) > > > Controller set of methods is returned.. > > > > $('#grid').grid().data(data).drig().show() > > $('#grid').grid().scrollToRow(6).drig().css("border", "1px") > > Uh, drig()? So if I want to return t

Re: [jQuery] Designing for reuse

2006-11-30 Thread Alan Gutierrez
jQuery is a library that acknowledges the existance of the DOM, and builds on on the DOM. Prototype is a library that focuses on creating controllers, and looks at the DOM more as a templating engine, not a data structure in itself. If all this method does... var grid = $('#grid').grid() ...is w

Re: [jQuery] Designing for reuse

2006-11-30 Thread Ⓙⓐⓚⓔ
only when it's better stated in jquery! which is always! On 11/30/06, Matt Stith <[EMAIL PROTECTED]> wrote: >Remember not everything needs to look like jQuery. Or does it? On 11/30/06, Stephen Howard <[EMAIL PROTECTED] > wrote: > > I know we're all fond of the elegance of chaining, but would

Re: [jQuery] Designing for reuse

2006-11-30 Thread Matt Stith
Remember not everything needs to look like jQuery. Or does it? On 11/30/06, Stephen Howard <[EMAIL PROTECTED]> wrote: I know we're all fond of the elegance of chaining, but would it be the least confusing to write it like: var gridControl = new Grid( '#grid' ) where: function Grid( dom_str

Re: [jQuery] Designing for reuse

2006-11-30 Thread Stephen Howard
I know we're all fond of the elegance of chaining, but would it be the least confusing to write it like: var gridControl = new Grid( '#grid' ) where: function Grid( dom_string ) { jQuery( dom_string ).each( function() { instantiate here... } ); ... } Remember not everything needs to l

Re: [jQuery] Designing for reuse

2006-11-30 Thread Brandon Aaron
On 11/30/06, Dave Methvin <[EMAIL PROTECTED]> wrote: > I don't know if this a good idiom; changing the object type within the chain > might be be too tricky. Also, would the plugin itself have a need for > chained methods to change its internal state? Still, to make your object > chainable like tha

Re: [jQuery] Designing for reuse

2006-11-30 Thread Dave Methvin
This will be a short thread--NOT! :-) > Controller set of methods is returned.. > > $('#grid').grid().data(data).drig().show() > $('#grid').grid().scrollToRow(6).drig().css("border", "1px") Uh, drig()? So if I want to return to I was before scrollToRow(6), should I use (6)woRoTllorsc? ;-) I don

Re: [jQuery] Designing for reuse

2006-11-30 Thread Alan Gutierrez
* Jörn Zaefferer <[EMAIL PROTECTED]> [2006-11-30 16:12]: > Alan Gutierrez schrieb: > > A controller object is returned.. > > > > var grid = null > > $("grid").grid({ > > data: data, > > onComplete: function(controller) { grid = controller } > > }) > > grid.srollToRow(6) > > > I favor th

Re: [jQuery] Designing for reuse

2006-11-30 Thread Jörn Zaefferer
Alan Gutierrez schrieb: > A controller object is returned.. > > var grid = null > $("grid").grid({ > data: data, > onComplete: function(controller) { grid = controller } > }) > grid.srollToRow(6) > I favor that approach, modified: var gridControl = $("#grid").grid(data); gridControl.sc

[jQuery] Designing for reuse

2006-11-30 Thread Alan Gutierrez
I'm using a grid plugin that I created based on what I've seen of other plugins. The grid method is added to jQuery and I can create a grid like so... var data = [['a', 'b'],['c','d']] $('#grid').grid({ data: data }).show() Later, I'm going to need to control the grid... $('#grid').scrollToRow(6