Re: [Catalyst] Database contents not displayed after hitting page refresh

2008-09-03 Thread cranky

It's working now. Thanx Emmanuel, that really helped.



cranky wrote:
 
 Hi, I'm a newbie to catalyst. I have built a small app, similar to the one
 in catalyst manual (basic CRUD). I have a page wherein a table displays
 its contents after getting it from the database (SQLite3), the problem is,
 it doesn't display the contents after I refresh the page.
 
 I'm using TT2 for html, here it is:
  
 --
 table
 [% WHILE (item = data.next) %]
   tr
   td [% item.function | html %] /td
   td [% item.testdate | html %] /td
   td [% item.tester | html %] /td
   td [% item.qalead | html %]/td
   td [% item.nopassed | html %] /td
 /table
 ---
 
 and the perl code looks like this:
 
 ---
 sub ShowData : Local {
   my ($self, $c) = @_;
   my $data = $c-model('Ttrack::Ttrack');   
   $c-stash-{data} = $data;  
   $c-stash-{template} = 'ShowData.tt2';
 }
 ---
 
 I generated the modules required under 'Model' by this command: 
 
 C:\formdata\ perl script\formdata_create.pl model Ttrack DBIC::Schema
 formdata::Schema::Ttrack create=static dbi:SQLite:database
 
 Where am I doing wrong?
 
 

-- 
View this message in context: 
http://www.nabble.com/Database-contents-not-displayed-after-hitting-page-refresh-tp19282861p19285334.html
Sent from the Catalyst Web Framework mailing list archive at Nabble.com.


___
List: Catalyst@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/


Re: [Catalyst] Database contents not displayed after hitting page refresh

2008-09-03 Thread Matt S Trout
On Wed, Sep 03, 2008 at 09:04:23AM +0200, Emmanuel Quevillon wrote:
 You need to perform a search in your 'ShowData' function to get data
 returned by the Resultset of your model 'Ttrack::Ttrack'.
 At this time, $data is only a resultset object without any data in it.
 Replace :
 
 my $data = $c-model('Ttrack::Ttrack');
 
 with
 
 my $data = $c-model('Ttrack::Ttrack')-search();

No, don't do that.

Those two lines are exactly equivalent except that -search will cause
a completely pointless clone of the resultset.

$c-model('Ttrack::Ttrack') is -already- a resultset for the whole table.

That's why there's something in there to search on.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
List: Catalyst@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/


Re: [Catalyst] Database contents not displayed after hitting page refresh

2008-09-03 Thread Matt S Trout
On Tue, Sep 02, 2008 at 09:48:08PM -0700, cranky wrote:
 
 Hi, I'm a newbie to catalyst. I have built a small app, similar to the one in
 catalyst manual (basic CRUD). I have a page wherein a table displays its
 contents after getting it from the database (SQLite3), the problem is, it
 doesn't display the contents after I refresh the page.

So it works on the first request but not on the second?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
List: Catalyst@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/


[Catalyst] Database contents not displayed after hitting page refresh

2008-09-02 Thread cranky

Hi, I'm a newbie to catalyst. I have built a small app, similar to the one in
catalyst manual (basic CRUD). I have a page wherein a table displays its
contents after getting it from the database (SQLite3), the problem is, it
doesn't display the contents after I refresh the page.

I'm using TT2 for html, here it is:
 
--
table
[% WHILE (item = data.next) %]
tr
td [% item.function | html %] /td
td [% item.testdate | html %] /td
td [% item.tester | html %] /td
td [% item.qalead | html %]/td
td [% item.nopassed | html %] /td
/table
---

and the perl code looks like this:

---
sub ShowData : Local {
my ($self, $c) = @_;
my $data = $c-model('Ttrack::Ttrack');   
$c-stash-{data} = $data;  
$c-stash-{template} = 'ShowData.tt2';
}
---

I generated the modules required under 'Model' by this command: 

C:\formdata\ perl script\formdata_create.pl model Ttrack DBIC::Schema
formdata::Schema::Ttrack create=static dbi:SQLite:database

Where am I doing wrong?

-- 
View this message in context: 
http://www.nabble.com/Database-contents-not-displayed-after-hitting-page-refresh-tp19282861p19282861.html
Sent from the Catalyst Web Framework mailing list archive at Nabble.com.


___
List: Catalyst@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/