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

2009-05-01 Thread Scott Pham (scpham)
You want to do..

 

$person-affiliation_id- affiliation_id

 

From: jagdish eashwar [mailto:jagdish.eash...@gmail.com] 
Sent: Friday, May 01, 2009 11:21 AM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data
gridsandCatalyst

 

Thanks, Adam. With the debug line in the code, for
$person-affiliation_id, I get 

[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xad06b00)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xad06a60)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xacff1e8)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xacff188)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xacff118)

If I change the debug line to get  $person-name, it gives me the
following nicely:

[debug] Whats this - Jagdish Eashwar
[debug] Whats this - Sushama Marathe
[debug] Whats this - Manasi Jagdish
[debug] Whats this - Ninad Jagdish
[debug] Whats this - Muttsy

The name column has no belongs_to relationship, but the affiliation_id
column has. That must be making the difference.



On Fri, May 1, 2009 at 4:16 PM, Adam Witney awit...@sgul.ac.uk wrote:


sub people_data : Local {
 my ( $self, $c ) = @_;

 my $rs = $c-model( 'AdventAjaxGrid2DB::People' );
 my @people = ();
 while ( my $person = $rs-next ) {
 push( @people, {
 id  = $person-id,
 name= $person-name,
 affiliation_id = $person-affiliation_id,

 

I would guess that this line is returning an Affiliation object rather
than the affiliation_id then? You could test it by adding this line
after the push

$c-log-debug('Whats this - '.$person-affiliation_id.\n);

if so then you would have to look at your Model.

Maybe someone with more experience could tell you the likely reason for
this?



HTH

adam

___
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/

 

___
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] Jason Kohles' tutorial on ExtJs editable data grids and Catalyst

2009-04-17 Thread Scott Pham (scpham)
Comment out console.log and see if that fixes your problem. Please
someone correct me if I'm wrong, but isn't that firebug only?

 

 

 

From: jagdish eashwar [mailto:jagdish.eash...@gmail.com] 
Sent: Friday, April 17, 2009 12:20 AM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data
grids and Catalyst

 

Hi,
No I don't get any javascript error in the error log when I hit  'save',
and it doesn't save the changes in the database either. Just nothing
happens.

On Thu, Apr 16, 2009 at 9:34 PM, W. Tyler Gee geek...@gmail.com wrote:

Is there a javascript error when you hit save or is it getting to the
server? Where is your actual problem?

 

On Thu, Apr 16, 2009 at 5:30 AM, jagdish eashwar
jagdish.eash...@gmail.com wrote:

Hi Peter,
Thanks for writing in. It is really not my code at all. I have taken it
all from the tutorial. I thought that people will get a better
perspective if I referred them to the tutorial. Nevertheless, I am
pasting code from the advent.js file below. ( I have made a few
inconsequential changes though, like the values in the drop down etc.)

/*
 * advent.js
 */

Ext.onReady(function() {

 var col_model = new Ext.grid.ColumnModel([
{
id: 'id',
header: 'ID',
dataIndex:  'id',
width:  40
},
{
id: 'name',
header: 'Name',
dataIndex:  'name',
editor: new Ext.form.TextField({
allowBlank: false,
})
},
{
id: 'occupation',
header: 'Occupation',
dataIndex:  'occupation',
width:  70,
editor: new Ext.form.ComboBox({
typeAhead:  true,
triggerAction:  'all',
transform:  'occpopup',
lazyRender: true,
listClass:  'x-combo-list-small'
})
}
]); 

col_model.defaultSortable = true;


var People = Ext.data.Record.create([
{ name:'id',type: 'int'},
{ name: 'name',type: 'string'},
{ name: 'occupation',type: 'string'}
]);


var store = new Ext.data.JsonStore({
url: gridurl,
root: 'people',
fields: People
});

var grid = new Ext.grid.EditorGridPanel({
store:  store,
cm: col_model,
title:  'Edit Persons',
width:  600,
height: 300,
frame:  true,
autoExpandColumn:   'name',
renderTo:   'datagrid',
tbar:   [
{   
text:   'New Person',
handler:function() {
var p = new People({
name:   'Unnamed New Person',
occupation:'Unknown',
}); 
grid.stopEditing();
store.insert( 0, p );
grid.startEditing( 0, 1 );
},
},
{
text:   'Save Changes',
handler:function() {
grid.stopEditing();
var changes = new Array();
var dirty = store.getModifiedRecords();
for ( var i = 0 ; i  dirty.length ; i++ ) {
var id = dirty[i].get( 'id' );
var fields = dirty[i].getChanges();
fields.id = dirty[i].get( 'id' );
changes.push( fields );
}
console.log( changes );
submitChanges( changes );
store.commitChanges();
},
},
{
text:   'Discard Changes',
handler:function() {
grid.stopEditing();
store.rejectChanges();
},
}
]
});


store.load();

function submitChanges( data ) {
Ext.Ajax.request({
url:posturl,
success:function() { store.reload() },
params: { changes: Ext.util.JSON.encode( data ) }
});
}
});

gridurl and posturl are defined in index.tt2 pasted below. It also
contains a link to advent.js.

[% META title = 'Advent AJAX Grid' %]
script type = text/javascript
var posturl = '[% Catalyst.uri_for(/people_data_submit) %]';
var gridurl = '[% Catalyst.uri_for(/people_data) %]';
/script
[% js_link (src = '/static/advent.js') %]
div id = datagrid/div
select id=occpopup style=display: none
option value=SBISBI/option
option value=IBSIBS/option
option value=ICICIICICI/option
option value=SELFSELF/option
/select







On Thu, Apr 16, 2009 at 7:41 PM, Peter 

RE: [Catalyst] Catalyst and ExtJS

2009-03-16 Thread Scott Pham (scpham)

 -Original Message-
 From: Adam Witney [mailto:awit...@sgul.ac.uk]
 Sent: Saturday, March 14, 2009 2:05 PM
 To: The elegant MVC web framework
 Subject: Re: [Catalyst] Catalyst and ExtJS
 
 
 On 14 Mar 2009, at 15:19, Scott Pham (scpham) wrote:
 
  -Original Message-
  From: Adam Witney [mailto:awit...@sgul.ac.uk]
  Sent: Saturday, March 14, 2009 10:36 AM
  To: The elegant MVC web framework
  Subject: [Catalyst] Catalyst and ExtJS
 
 
  Hi,
 
  I was thinking about using Catalyst and ExtJS, does anyone have any
  experience or know if they will play nicely together? Doing some
  googling implies that this is not a popular combination due to the
  limited information
 
  thanks for any help
 
  adam
 
 
  Yes I currently have a couple of apps that use ExtJS + Catalyst,
 works
  great for me!
 
 Hi Scott,
 
 thanks for the info, do you use any particular module or have you
 built it yourself? I have found so far:
 
 HTML::FormFu::ExtJS
 Catalyst-Controller-HTML-FormFu-ExtJS
 
 any you'd recommend taking a look at?
 
 thanks again
 
 adam
 

I built it myself using Catalyst::View::JSON and TT. It's actually
pretty easy when you get the hang out it.


___
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] Catalyst and ExtJS

2009-03-16 Thread Scott Pham (scpham)


 -Original Message-
 From: Adam Witney [mailto:awit...@sgul.ac.uk]
 Sent: Monday, March 16, 2009 3:00 PM
 To: The elegant MVC web framework
 Subject: Re: [Catalyst] Catalyst and ExtJS
 
 
  No, don't do that!
 
  Use $row-get_columns which returns a hash of the column data!
  Accessing internal methods is bad, accessing internal hash keys is
  doubleplusungood.  If you find yourself doing that, go read some
  documentation.  If you haven't figured it out without doing that,
  submit a patch for a proper method!
 
  Here's the pod:
  http://search.cpan.org/~ribasushi/DBIx-Class-
 0.08012/lib/DBIx/Class/Row.pm#get_columns
 
  Also, you can use the HashRefInflator which works -fantastic- for
  JSON views:
 
  The code is very simple:
 
  my $rs = $c-model('DB::Books');
  $rs-resultclass('DBIx::Class::HashRefInflator');
  $c-stash-{books} = [ $rs-all ];
 
  You can read about that here:
  http://search.cpan.org/~ash/DBIx-Class-
 0.08010/lib/DBIx/Class/ResultClass/HashRefInflator.pm
 
 excellent, thanks guys, with minor modifications both those approaches
 work:
 
  $c-stash-{books} = [map { $_-get_columns } $c-
  model('DB::Books')-all];
 
 OR:
 
  my $rs = $c-model('DB::Books');
  $rs-result_class('DBIx::Class::ResultClass::HashRefInflator');
  $c-stash-{books} = [ $rs-all ];
 
 thanks again for your help
 
 adam

You only want to present the data you need to ExtJS, you were stuffing
the whole dbic resultset object into the JSON ;).



___
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] Catalyst and ExtJS

2009-03-14 Thread Scott Pham (scpham)
 -Original Message-
 From: Adam Witney [mailto:awit...@sgul.ac.uk]
 Sent: Saturday, March 14, 2009 10:36 AM
 To: The elegant MVC web framework
 Subject: [Catalyst] Catalyst and ExtJS
 
 
 Hi,
 
 I was thinking about using Catalyst and ExtJS, does anyone have any
 experience or know if they will play nicely together? Doing some
 googling implies that this is not a popular combination due to the
 limited information
 
 thanks for any help
 
 adam


Yes I currently have a couple of apps that use ExtJS + Catalyst, works
great for me!

___
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] Catalyst - any good AJAX tutes?

2009-03-06 Thread Scott Pham (scpham)
I second that ExtJS recommendation. The user community is pretty good
from a support point of view. Once you get the hang of it, it's really
easy to do a lot of neat things with it.




-Original Message-
From: Alexander Hartmaier [mailto:alexander.hartma...@t-systems.at] 
Sent: Friday, March 06, 2009 12:14 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Catalyst - any good AJAX tutes?

I'd suggest ExtJS if you want something pretty good looking with great
out-of-the-box features or YUI/jQuery if you like to stick with
JS-enhanced HTML.

The Dojo features + docs sucked *very* much when I used it about a year
ago...

On the Catalyst side I use Catalyst::Controller::DBIC::API which will
support the full DBIC API for searches, pagination and prefetch in the
next version which should be on CPAN in 2-4 weeks if lukes and I find
time to finish it.
trunk already contains my json-style search and pagination patches but
lacks prefetch support cause we need to find a way to restrict/validate
the user input to prevent huge queries killing the DB and/or revealing
data that shouldn't be revealed.

Help welcome ;-) (yes, I mean you Matt! that json in cgi param idea of
yours just rocks!)

-
Alex


Am Freitag, den 06.03.2009, 06:43 +0100 schrieb kakim...@tpg.com.au:
 hello there,

  I would like to use AJAX in my catalyst app. Any good
references/tutes
 to recommend?

 thanks.

 K. akimoto


 ___
 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/



***
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b

***
Notice: This e-mail contains information that is confidential and may be
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.

***

___
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/

___
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/