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

jagdish eashwar jagdish.eashwar at gmail.com
Sun May 17 06:46:41 GMT 2009


Hi everyone (especially Peter and Craig),

After much searching, I finally found out through firebug that my url was
being set to an empty string. And after still some more head-scratching, I
realised that this time it really was the issue of 'Catalyst.uri_for' vs
'c.uri_for'. My earlier version of Catalyst used to expressly set the
CATALYST_VAR to Catalyst. This version doesn't. I guess the default
CATALYST_VAR is 'c'.
Thanks Peter and Craig for making me aware of this.

Jagdish

On Mon, May 11, 2009 at 7:10 PM, jagdish eashwar
<jagdish.eashwar at gmail.com>wrote:

> 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 Ubu=
ntu
> 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 thin=
k,
> in MyExtGrid app, the people_data sub in Root.pm is just not picking up d=
ata
> 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 a=
pp
> 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>w=
rote:
>
>>  *From:* jagdish eashwar <jagdish.eashwar at gmail.com>
>>
>> > the model. Disregarding the instruction not to modify anything above t=
he
>> 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 y=
ou
>> won't be able to re-create the class files using the helper anymore, bec=
ause
>> 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
>> tell 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 on=
ly
>> 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
>> easy 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/20090517/fe164=
3c4/attachment.htm


More information about the Catalyst mailing list