Jeff Barczewski
2006-Jul-28 15:16 UTC
[Masterview-devel] Some rough ideas for ajax grid table directive syntax
Deb, I have been planning for a directive that would add ajax capabilities to an ordinary table (ajax sort, page forward/back), this would make it dead simple to add this functionality without doing any manual javascript work. The idea is to make this very easy to add to an existing table. Additional things could be done to do inline edit and stuff like that, but I will save that for later. Here is an idea for the syntax It basically identifies what model we are pulling from, what columns, what the sort and secondary sort would be for each column (when you click on the heading to sort). It would generate the proper rhtml and partials under the covers and all the necessary javascript to click on headings etc. If you don''t care about secondary sort then you can even eliminate the :sort param. <table mv:ajax_grid="product, :cols => [:name, :desc, :date], :sort => [:column, :date]"> <tr><th>Name</th><th>Description</th><td>Date</th></tr> <tr><td>name1</td><td>desc1</td><td>date1</td></tr> </table> or alternately specifying the columns using nested directives so that they could be rearranged in WYSIWYG editor. Directives can work with nested directives to accomplish interesting things or for that matter they can also read style or anything that is nested. <table mv:ajax_grid="product, :sort => [ :column, :date ]"> <tr><th>Name</th><th>Description</th><td>Date</th></tr> <tr><td mv:column="name">name1</td><td mv:column="desc">desc1</td><td mv:column="date">12/31/2006</td></tr> </table> and if we go the extra step to allow alternating row styles we could allow this, the below would apply rowStyle1, rowStyle2, and rowStyle3 to each row allowing a nice striping effect <table mv:ajax_grid="product"> <tr><th>Name</th><th>Description</th></tr> <tr class="rowStyle1"><td>name1</td><td>desc1</td></tr> <tr class="rowStyle2"><td>name2</td><td>desc2</td></tr> <tr class="rowStyle3"><td>name3</td><td>desc3</td></tr> <tr class="rowStyle1"><td>name4</td><td>desc4</td></tr> <tr class="rowStyle2"><td>name5</td><td>desc5</td></tr> <tr class="rowStyle3"><td>name6</td><td>desc6</td></tr> </table> Let me know what you think. But these are the types of directives that I think really show off the power of MasterView. Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060728/290d08d3/attachment-0001.html
Deb Lewis
2006-Jul-31 03:55 UTC
[Masterview-devel] Some rough ideas for ajax grid table directive syntax
Jeff - got it, need to "digest" a bit before responding. Tables always end up being ridiculously complicated because of the endless little variations and complexities, so the challenge is to do something that''s simple but not useless. ~ Deb -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060730/e518745c/attachment.html
Jeff Barczewski
2006-Jul-31 18:31 UTC
[Masterview-devel] Some rough ideas for ajax grid table directive syntax
Right, One needs to find the 80% solution that meets a good portion of users needs. However I think one can take something simple and if one takes into account nested directives one can get a good portion of that other 20% too. For instance if the default ajax_grid directive by default simply outputs the data for each field in the td columns, one could always apply a mv:content directive to override this and fill it with whatever is wanted. I think similar to Streamlined you can get most of the way there if you have some simple config options, but then if you combine other directives into the mix we can pretty much do anything. One would always have the ability to code up partials as we do today and then drive them however they want, but I think for many situations we can just make this easier. Jeff On 7/30/06, Deb Lewis <djlewis at acm.org> wrote:> > > Jeff - got it, need to "digest" a bit before responding. Tables always end > up being ridiculously complicated because of the endless little variations > and complexities, so the challenge is to do something that''s simple but not > useless. > > ~ Deb
Jeff Barczewski
2006-Jul-31 18:36 UTC
[Masterview-devel] Some rough ideas for ajax grid table directive syntax
Also just to note, after I thought about it more, I think that the first syntax where the majority of the info is specified in the directive is the most straight forward. We can still pick up the distinct row styles if there is to be alternating row format along with the other style specifics for the particular columns. We''d use the first td row for the partial to iterate on, injecting the appropriate row style based on the mod count. Jeff On 7/31/06, Jeff Barczewski <jeff.barczewski at gmail.com> wrote:> Right, One needs to find the 80% solution that meets a good portion of > users needs. However I think one can take something simple and if one > takes into account nested directives one can get a good portion of > that other 20% too. For instance if the default ajax_grid directive by > default simply outputs the data for each field in the td columns, one > could always apply a mv:content directive to override this and fill it > with whatever is wanted. > > I think similar to Streamlined you can get most of the way there if > you have some simple config options, but then if you combine other > directives into the mix we can pretty much do anything. > > One would always have the ability to code up partials as we do today > and then drive them however they want, but I think for many situations > we can just make this easier. > > Jeff > > On 7/30/06, Deb Lewis <djlewis at acm.org> wrote: > > > > > > Jeff - got it, need to "digest" a bit before responding. Tables always end > > up being ridiculously complicated because of the endless little variations > > and complexities, so the challenge is to do something that''s simple but not > > useless. > > > > ~ Deb >