View Full Version : Creating a Grid 'on the fly'

15 Feb 2008, 3:29 AM
Hi Forum,

I would like to present some data (from very little to over 3000 rows) on a web page. At the moment I am using perl catalyst and perl template (with as little JS as possible) to do this. Ext JS appears to offer a very clean way of presenting the data (the array-grid example on the home page is ideal).

I have no idea where to start with passing the data, currently in a perl array of arrays, from the Controller to the View in a way that I can pass it to Ext JS without having to do much data manipulation.

I have very little knowledge of Javascript - although I have already used some basic JS and Prototype.

Pointers would be most welcome ... I am not adapting to the ext js documentation system.

Thanks in advance.

I apologise if this is a painfully stupid question ... I don't do much coding on 'front-ends'

15 Feb 2008, 5:00 AM
I think I have found some sort of answer. From the catalyst backend I can use the the JSON module (use JSON) to convert the array to a JSON object ( $c->stash{FOO} = to_json($bar);
Then I can read this in using an Ext function.

15 Feb 2008, 8:25 AM
that sounds very similar to how its typically done in php; create an array or object, encode it to json and output it.
you can look at some of the examples (theres a great one for doing an editorgrid with a php backend) that show how the json should be formatted. also be warned that 3000 rows most likely will be extremely slow at rendering, so you should definently consider using server side paging.

4 Jun 2008, 4:25 PM
I'm using Perl & Catalyst with Ext too. This entry in the Catalyst advent calendar really helped me: