[Catalyst] HTML::Dojo

Peter Edwards peter at dragonstaff.com
Mon Nov 12 19:19:44 GMT 2007


I'd recommend ExtJS over Dojo. We did an app with it a few months ago after
a recommendation here and it rocked. It's faster than Dojo which was a big
plus. Version 2 now out.
http://extjs.com/ 
To serve it data use Catalyst::View::JSON. It's easier than you might think.

We could do a simple Advent day on this, although someone already
volunteered YUI (which ExtJS spawned off) so maybe not necessary?

Alternatively we could do a simple app that uses multiple .pl configuration
files and demonstrates batch program access to DBIC data objects?
(Been meaning to release this as a Cat demo app so it would be a good
motivator for us to get on with it.)

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com   Business IT Consultancy


-----Original Message-----
From: Jonathan Rockway [mailto:jon at jrock.us] 
Sent: 12 November 2007 18:51
To: The elegant MVC web framework
Subject: Re: [Catalyst] HTML::Dojo


On Mon, 2007-11-12 at 10:44 -0800, Will Smith wrote:
> Please show me a simple example such as auto complete or chained
> select fields.

That's too much work.  How about googling "dojo autocomplete", and
reading an article like this:

http://today.java.net/pub/a/today/2006/04/27/building-ajax-with-dojo-and-jso
n.html

To make that work with Catalyst, just replace the java:

   public String toJSONString() throws JSONException {
    JSONObject jsonObj = new JSONObject();
    jsonObj.put("bookId", new Integer(this.bookId));
    jsonObj.put("title", this.title);
    jsonObj.put("isbn", this.isbn);
    jsonObj.put("author", this.author);
    return jsonObj.toString();
   }

With Perl:

   sub search_for_book :Local {
      my ($self, $c, $search_term) = @_;
      my @results =
$c->model('Books')->search_for_completion_of($search_term);
      $c->stash->{json} = { results => \@results };
      $c->detach($c->view('JSON'));
      # or whatever
   } 

Catalyst rarely cares what you use for javascript.  You send the
javascript code data, the javascript does its thing, and perhaps the
javascript requests some more data.  The hard part is javascript, so
that's what you need to learn first.

Regards,
Jonathan Rockway



_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list