[Catalyst] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst

jagdish eashwar jagdish.eashwar at gmail.com
Mon May 11 13:40:13 GMT 2009


Hi,

I think I need help again.

Some days ago, i had worked through Jason Kohles' tutorial on the ExtJS Grid
with help from several people on the mailing list. I was then on Ubuntu
8.04. I have now upgraded to Ubuntu 9.04 and along with it Catalyst also got
upgraded to 5.0715. I don't remember the version number of the previous
Catalyst, but it used yaml instead of Config::General for the config file.

Now when I am trying to work through the tutorial again after a short break,
I am unable to get things working fully. In the new MyExtGrid app, the grid
is displayed in the browser, but it is not populated with data. My old
AdventAjaxGrid app, however, still works fine with Ubuntu 9.04 and Catalyst
5.0715. I have compared the code in the two Apps several times, but I don't
seem to be able to find anything wrong or different there. I think, in
MyExtGrid app, the people_data sub in Root.pm is just not picking up data
from the database. So I am pasting relevant snippets of code.

Controller Code in Old App:
---------------------------
sub people_data : Local {
    my ($self,$c) =3D @_;

    my $rs =3D $c->model ('AdventAjaxGridDB::People');
    my @people =3D ();
    while (my $people =3D $rs->next) {
        push (@people, {
            id =3D> $people->id,
            name =3D> $people->name,
            occupation =3D> $people->occupation,
            });
    $c->log->debug("what's this - ".$people->name."\n");
        }
        $c->stash->{'people'} =3D \@people;
        $c->detach ($c->view('JSON'));
        }


Messages that I get from Catalyst
---------------------------------
[info] AdventAjaxGrid powered by Catalyst 5.7015
You can connect to your server at http://ubuntu-office:3000
[info] *** Request 1 (0.100/s) [11666] [Mon May 11 14:47:20 2009] ***
[debug] "GET" request for "/" from "127.0.0.1"
[debug] Rendering template "index.tt2"
[debug] Applying HTML page layout wrappers to index.tt2
[info] Request took 0.206001s (4.854/s)
.----------------------------------------------------------------+---------=
--.
| Action                                                         | Time
|
+----------------------------------------------------------------+---------=
--+
| /index                                                         | 0.000655s
|
| /end                                                           | 0.155815s
|
|  -> AdventAjaxGrid::View::TT->process                          | 0.151578s
|
'----------------------------------------------------------------+---------=
--'

[info] *** Request 2 (0.154/s) [11666] [Mon May 11 14:47:23 2009] ***
[debug] Query Parameters are:
.-------------------------------------+------------------------------------=
--.
| Parameter                           | Value
|
+-------------------------------------+------------------------------------=
--+
| _dc                                 | 1242033443165
|
'-------------------------------------+------------------------------------=
--'
[debug] "GET" request for "people_data" from "127.0.0.1"
[debug] Path is "people_data"
[debug] what's this - jagdish eashwar
[debug] what's this - sushama marathe
[debug] what's this - manasi
[debug] what's this - ninad
[info] Request took 0.058423s (17.117/s)
.----------------------------------------------------------------+---------=
--.
| Action                                                         | Time
|
+----------------------------------------------------------------+---------=
--+
| /people_data                                                   | 0.046012s
|
|  -> AdventAjaxGrid::View::JSON->process                        | 0.001213s
|
| /end                                                           | 0.001242s
|
'----------------------------------------------------------------+---------=
--'


Controller Code in New App:
---------------------------
sub people_data : Local {
    my ($self,$c) =3D @_;

    my $rs =3D $c->model ('MyExtGridDB::People');
    my @people =3D ();
    while (my $people =3D $rs->next) {
        push (@people, {
            id =3D> $people->id,
            name =3D> $people->name,
            occupation =3D> $people->occupation,
            });
    $c->log->debug("What's this - ".$people->name."\n");
        }
        $c->stash->{'people'} =3D \@people;
        $c->detach ($c->view('JSON'));
        }


Messages that I get from Catalyst
---------------------------------

[info] MyExtGrid powered by Catalyst 5.7015
You can connect to your server at http://ubuntu-office:3000
[info] *** Request 1 (0.143/s) [11987] [Mon May 11 15:08:51 2009] ***
[debug] "GET" request for "/" from "127.0.0.1"
[debug] Rendering template "index.tt2"
[info] Request took 0.169082s (5.914/s)
.----------------------------------------------------------------+---------=
--.
| Action                                                         | Time
|
+----------------------------------------------------------------+---------=
--+
| /index                                                         | 0.000573s
|
| /end                                                           | 0.151973s
|
|  -> MyExtGrid::View::TT->process                               | 0.148399s
|
'----------------------------------------------------------------+---------=
--'



The messages regarding query parameters and JSON which I get in the old app
don't come at all in the new app.

What could the problem/error be? Could it be anywhere else in the code?

Thanks,

Jagdish


On Sun, May 3, 2009 at 12:03 PM, Octavian R=E2snita <orasnita at gmail.com>wro=
te:

>  *From:* jagdish eashwar <jagdish.eashwar at gmail.com>
>
> > the model. Disregarding the instruction not to modify anything above the
> md5sum line, I changed the relationship name in People.pm from
> > 'affiliation_id' to 'affiliation'.  I could then access the
> affiliation_id column in the People table without having to mention the
> relationship name.
> > Nice. But what is the recommended way for getting around the problem of
> the catalyst helper using the column name for the relationship
> > name ? To what extent can one safely disregard the 'don't modify'
> instruction?
>
> You can disregard it entirely and make any change above that line, but you
> won't be able to re-create the class files using the helper anymore, beca=
use
> if the helper would re-create the modified (above that line) classes, it
> would delete all the changes that you made above that line, and your app
> might not work well because of this.
>
> It could be helpful though if the helper would accept a parameter that te=
ll
> it to change all the classes that were not modified above that line, and
> create separate classes with a .new extension for those classes that were
> changed. It would be more flexible then, because we can still use it after
> we change some classes above the checksum.
>
> Until then... I've seen that the recommendation was to use the helper only
> until you need to make changes above that line, and after that point, use
> the classes as a base, and deploy them for changing the database.
> (I don't know if this solution would work with any database type though..=
.)
>
> Anyway, does anyone have an example about how to do that deployment as ea=
sy
> as possible?
>
> Octavian
>
>
> _______________________________________________
> 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.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090511/b3489=
14a/attachment.htm


More information about the Catalyst mailing list