$grid = Grid::factory('customers_grid', Model_Customer::init()->with('country')) ->add_column('first_name', array( 'index' => 'first_name', 'label' => 'First Name', )) ->add_column('last_name', array( 'index' => 'last_name', 'label' => 'Last Name', )) ->add_column('created_at', array( 'index' => 'created_at', 'label' => 'Created At', 'renderer' => 'date', 'width' => 100, 'align' => 'center', )) ->add_column('region_name', array( 'index' => 'region:name', 'label' => 'Region', )) ->add_massaction('create_invoice', array( 'action' => 'test/url/mass_create_invoice', 'label' => 'Create Invoice', )) ->render();
Fantastic! Looking forward to the screen casts.Ben Corlett wrote on Sunday 17th of April 2011:@akian0 thanks for the feedback! I've not made any documentation yet as I've not fully completed the first version of the plugin, but I will surely make lots of documentation including screen casts as soon as it's all done. as a quick teaser see the following:
$grid = Grid::factory('customers_grid', Model_Customer::init()->with('country')) ->add_column('first_name', array( 'index' => 'first_name', 'label' => 'First Name', )) ->add_column('last_name', array( 'index' => 'last_name', 'label' => 'Last Name', )) ->add_column('created_at', array( 'index' => 'created_at', 'label' => 'Created At', 'renderer' => 'date', 'width' => 100, 'align' => 'center', )) ->add_column('region_name', array( 'index' => 'region:name', 'label' => 'Region', )) ->add_massaction('create_invoice', array( 'action' => 'test/url/mass_create_invoice', 'label' => 'Create Invoice', )) ->render();
Be sure you merge the contents of the assets folder with the assets folder in your public folder./Users/bencorlett My mate and I will have some screen casts done up very soon. we use screen flow and because we're both registered apple devs we're using mac os x lion, and screen flow isn't working with mac os x lion so we're going to have to do it on another computer.
Dream Forge wrote on Wednesday 27th of April 2011:Hi there,
Your grid package looks really nice!
To give it a try, I used something like your teaser code example above.
(With the latest version of Spark from the github repo, Fuel RC2 and fuel's orm package).
$grid = Grid::factory('customers_grid', Model_Customer::init()) ->add_column('first_name', array( 'index' => 'first_name', 'label' => 'First Name', )) ->add_column('last_name', array( 'index' => 'last_name', 'label' => 'Last Name', )) ->add_column('created_at', array( 'index' => 'created_at', 'label' => 'Created At', 'renderer' => 'date', 'width' => 100, 'align' => 'center', )) ->add_massaction('create_invoice', array( 'action' => 'test/url/mass_create_invoice', 'label' => 'Create Invoice', )) ->render();
Then assuming that the $grid variable now contains some View (the container), I passed it strait away from my controller to some view :$this->response->body = $grid;
But this gave me the error : "[Error]: Call to a member function get_identifier() on a non-object".
(PKGPATH/spark/views/grid/table.php @ line 30)
when doing<table class="<?=$grid->get_identifier()?>" ...
What am I doing wrong?
Ben Corlett wrote on Sunday 1st of May 2011:Hey I'm not sure what's happening with that but I'll check it out in the morning (it's night here in Australia) I probably did something dumb and pushed to gothic, I've not pushed all of the latest changes to Github Sorry for not getting back for so long but I'll have an answer for you guys in about 12 hours
$grid = Grid::factory('customers_grid', Model_Customer::init()) ->add_column('first_name', array( 'index' => 'first_name', 'label' => 'First Name', )) ->add_column('last_name', array( 'index' => 'last_name', 'label' => 'Last Name', )) ->add_column('created_at', array( 'index' => 'created_at', 'label' => 'Created At', 'renderer' => 'date', 'width' => 100, 'align' => 'center', )) ->add_massaction('create_invoice', array( 'action' => 'test/url/mass_create_invoice', 'label' => 'Create Invoice', )) ->render();
$this->response->body = $grid;
<table class="<?=$grid->get_identifier()?>" ...
It looks like you're new here. If you want to get involved, click one of these buttons!