Saturday, October 11, 2008

Big news for the incoming P4A 3.2

Yes, big news for the incoming P4A 3.2

I've just finished to commit the first beta release of a new widget: the p4a_grid.
What is it? It's simply an editable table. This widget has been for a lot of time a highly requested feature so now I'm really happy to have it :) There's a lot of work to be done to have the perfect widget, for example to add checkbox cells and combo box cells, but now it already does a good job.

Using the p4a_grid is similar to using the p4a_table:

$this->build("p4a_grid", "grid")
->setWidth(600)
->setSource($this->source)
->setVisibleCols(array("product_id", "model", "date_arrival", "category", "brand"));

Now you have two options:

1) Using the "autosave" method to save automatically the changed values to database

$this->grid->autosave();

2) Intercepting the onChange event if you need to add more complex business logic:

$this->intercept($this->grid,'onChange','myhandler');
...
function myhandler($obj,$params){
/*
$params[0] -> the primary key value
$params[1] -> the column name
$params[2] -> the formatted new value
$params[3] -> the unformatted new value
*/
...
}

If you want to try it checkout it from svn and please give me your feedback :)

4 comments:

blas said...

I'm sure it will be great !!!

When do you think that it can be downloaded ? What are the p4a release plans ?

blas

Anonymous said...

Actually it IS a great function. It took me 30 seconds to transform my p4a_table into a completely editable p4a_grid. Swift!

Only drawback on the whole P4A business is the lack of tutorials. I'm having a hard time now that I've finished working through the 4 short manuals in the wiki (and even those on 2.0), the PHPdoc manual and your blog entries. With more documentation available, P4A could become one of the most popular frameworks for RAD out there!

Unknown said...

Same situation here Cy...
Hoping that documentation and tutorials rains soon... specially on field, validation and events.
More Power to P4A!!!!

Anonymous said...

Hi... how to save all changed records (e.g: 30 rows data changed) in P4A Grid at one time by pressing save button. For sure I ve to disable autosave. But when user press save button how can I check one by one all changed record in P4A Grid and perform saveRow ?

rosni@tarantula.my