CatalystX::CRUD::YUI::LiveGrid - ExtJS LiveGrid objects
my $livegrid = $yui->livegrid( results => $results, # CX::CRUD::Results or CX::CRUD::Object controller => $controller, form => $form, method_name => $rel_info->{method}, col_names => $form->metadata->field_methods, c => $c, # Catalyst context object ); $livegrid->serialize; # returns serialized results $livegrid->count; # returns number of rows
This class represents the data necessary to support the ExtJS-base LiveGrid component http://www.siteartwork.de/livegrid/.
Create a YUI LiveGrid object. You usually call this via CatalystX::CRUD::YUI->livegrid( opts ).
opts should include:
The results object passed in. May be either a CatalystX::CRUD::Results instance or CatalystX::CRUD::Object instance.
If a Results instance, each object in the Results set will be serialized.
If a Object instance, each object returned by method_name will be serialized.
The form object should be an instance of the Form class that corresponds to the data being serialized. In the case where results isa CatalystX::CRUD::Results object, form should be a Form corresponding to the object class in CatalystX::CRUD::Results->results(). In the case where results isa CatalystX::CRUD::Object, form should be a Form corresponding to the foreign object class represented by method_name.
The controller object should be the governing controller for the objects being serialized, i.e., the controller governing form.
The new LiveGrid has the following accessors available:
The primary key of the table that results represents.
An arrayref of column hashrefs. YUI LiveGrid API requires these.
The url for fetching JSON results.
A hashref of foreign key information.
An arrayref of column names. Used for filtering table by specific column values.
An arrayref of column names. Defaults to form->metadata->field_methods.
An arrayref of hashrefs. These are serialized from results.
The number of items in data.
User-level accessor. You can get/set this to whatever you want.
NOTE: If you pass a CatalystX::CRUD::Object instance as results to new(), the object must implement a primary_key_uri_escaped() method that conforms to the syntax defined by CatalystX::CRUD::Controller make_primary_key_string(). See Rose::DBx::Object::MoreHelpers for one example.
Return the column hashref meta for field_name. The hashref has 3 keys: key, label, and sortable.
Returns LiveGrid as array ref of hash refs, suitable for conversion to JSON or other transport type.
Returns hash ref suitable for JSON-ifying and passing to the LiveGrid JsonReader constructor.
Returns array ref suitable for JSON-ifying and passing to the LiveGrid JsonReader constructor.
Returns array ref suitable for JSON-ifying for LiveGrid JS.
Peter Karman, <karman@cpan.org>
<karman@cpan.org>
Please report any bugs or feature requests to bug-catalystx-crud-yui@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalystx-crud-yui@rt.cpan.org
The Minnesota Supercomputing Institute http://www.msi.umn.edu/ and NALD http://www.nald.ca/ sponsored the development of this software.
http://www.msi.umn.edu/
http://www.nald.ca/
Copyright 2008 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CatalystX::CRUD::YUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::CRUD::YUI
CPAN shell
perl -MCPAN -e shell install CatalystX::CRUD::YUI
For more information on module installation, please visit the detailed CPAN module installation guide.