php - How to show zend framework data grid data sorted by "date" as default? -
How do sort grid data show data grid data according to "date"? When I come to the page, I want to see the data grid sorted by the time as the default without parameters like URL ... / order / created DESC /
$ Testimonials = new Application_Model_DbTable_Testimonials (); $ Source = new Bvb_Grid_Source_Zend_Table ($ testimonial); Thanks.
I solved it by going to $ datagrid instead of $ object
$ testimonials = new Application_Model_DbTable_Testimonials (); $ Source = new Bvb_Grid_Source_Zend_Table ($ testimonial); now
$ testimonial = new Application_Model_DbTable_Testimonials (); $ Testimonials- & gt; SetSortOrder ('created'); $ Source = new Bvb_Grid_Source_Zend_Select ($ testimonial-> getTestimonials ());
It's hard to see what your class is doing, because you posted that post
Option 1 But when it uses the fetchAll () function, you can do two things: Option 1 When there is a fetch () - Call in grid class, you can make it one:
$ testimonialTable-> Fetch all (empty, 'date')); Option 2 You can type the system in fetchAll Application_Model_DbTable_Testimonials Class, when you create public function fetchRow ($ where = zero, $ command = zero, $ offset = null) {if ($ command === faucet): $ command = ' Date '; end if; Return to original: fetchAll (where, $ offset, offset)} Please note in the previous example, fetchess will always be sorted by date fields.
Comments
Post a Comment