Tag Archives: datagrid

Propel / Pager / Datagrid – Part II

9 Jan

In my previous post, i talked about the writing of a custom datagrid for propel usage. The required features for this datagrid would be :

  • easy configuration
  • multi sortable columns (ascending & descending)
  • search features
  • add actions to one or multiple records (icon + action)
  • sizeable columns
  • go to page x
  • ability to change rows per page

So since my last post, 2 weeks have passed and i am proud to say we’ve finished a large part of the code. Now we are still having problems with the javascript to allow the user to change his column width in multiple browsers, IE seems to refuse some of the javascript code. I am still looking into that.

P.S. : I have been getting several e-mails with code requests. Untill i am really done i won’t give out the code. If you think you can help me with the javascript resizing issue though, you can always drop me an e-mail.

Propel / Pager / Datagrid

15 Dec

Because we are using propel in most of our larger projects, it’s very common we need a datagrid for the listing of the objects. A year ago we made a datagrid with the most important features combined with an ajax approach (sorting, filtering…), for the ajax functionality we wrote our own javascript function calls, what led to alot of unmanageable code, both javascript and php.

As time moved on, this loading of the datagrid became slower and slower (due to increasing objects, about 9000 records with multiple joined tables). This was mainly because the old datagrid first loaded all objects, and then sorted the entire array by the columns as defined by the user….don’t tell me..i know ! This is a bad approach, that means all records get looped, and if you are using propel that would mean for each of those 9000+ records an object is created…that’s crazy…(it has some advantages though)…

So now i finally found some time to do a total rewrite of this datagrid, combined with the power of the propel pager, propel criteria & the php/ajax framework xajax, i came up, faster then expected, with a powerfull scalable datagrid that only loads the visible records. All switchpages, sorting & filters call a corresponding ajax function. These functions change the criteria in the object and reload the datagrid. I’ll elaborate on this later, by showing you some code and perhaps an online example.