| View previous topic :: View next topic |
| Author |
Message |
FlipFlop
Joined: 06 Aug 2007 Posts: 7
|
Posted: Wed Aug 29, 2007 7:51 pm Post subject: Sorting with Array as DataSource |
|
|
Hi again,
I have troubles with sorting (clicking on the column header) on a SDG generated table. I have the following code:
| Code: |
$dg =& new Structures_DataGrid(20);
$dg->addColumn(new Structures_DataGrid_Column('Signed' , 'signed' , 'signed' , null, null, 'HasSigned()'));
$dg->addColumn(new Structures_DataGrid_Column('Forename' , 'forename' , 'forename' , null, null, ''));
$dg->addColumn(new Structures_DataGrid_Column('Surname' , 'surname' , 'surname' , null, null, ''));
...
...
// Bind datasource
$res = $dg->bind($Members);
|
$Members is an normal array that looks like:
| Code: |
[UID]['signed'][TRUE]
['forename']['whatever']
['lastname']['same']
...
...
|
SDG does display the table correctly but if I try to sort any column, the order will change but not right at all. In the GET vars I can see that SDG want do it right because of this: orderBy=forename&direction=ASC&page=1
Does someone have an idea why sorting wont work as expected?
greats mike |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Wed Aug 29, 2007 8:27 pm Post subject: |
|
|
| Your $Members example looks a little bit weird. Can you please show the output of var_dump($Members); (from the start until the end of the first row)? |
|
| Back to top |
|
 |
FlipFlop
Joined: 06 Aug 2007 Posts: 7
|
Posted: Thu Aug 30, 2007 10:02 am Post subject: |
|
|
Sure, here it is:
| Code: | | array(43) { [1]=> array(27) { ["forename"]=> string(7) "Herbert" ["surname"]=> string(8) "Mattulik" ["street"]=> string(12) "Hauptstrasse" ["postcode"]=> NULL ["city"]=> NULL ["to_country"]=> string(7) "Austria" ["dateofbirth"]=> string(19) "1960-01-01 00:00:01" ["email"]=> NULL ["url"]=> NULL ["phone"]=> NULL ["to_status"]=> string(8) "Mitglied" ["active"]=> int(1) ["signed"]=> int(0) ["joiningdate"]=> string(19) "2007-07-25 00:00:01" ["contribution"]=> NULL ["to_contrstatus"]=> string(10) "1. Mahnung" ["comment"]=> NULL ["createdon"]=> string(19) "2007-07-25 18:03:25" ["createdby"]=> string(5) "Berni" ["newsletter"]=> int(0) ["Id"]=> int(1) ["BMX"]=> int(0) ["Inline"]=> int(2) ["Skateboard"]=> int(0) ["Streetboard"]=> int(0) ["Freestyle MTB"]=> int(0) ["Other"]=> int(99) } |
|
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Thu Aug 30, 2007 3:03 pm Post subject: |
|
|
Okay, the array structure looks right.
Which PHP version do you use? Do you have the latest versions of SDG and the array DataSoure driver installed?
And how is the sorting "not right at all"? (If you want, send me a screenshot of the wrong sorting to wiesemann(at)php.net.) |
|
| Back to top |
|
 |
FlipFlop
Joined: 06 Aug 2007 Posts: 7
|
Posted: Thu Aug 30, 2007 3:58 pm Post subject: |
|
|
I'm using PHP Version 5.2.0.
SDG:
Structures_DataGrid has version 0.8.3 beta and
Structures_DataGrid_DataSource_Array has version 0.1.2 beta
After binding I use the Smarty Renderer for output but that shouldn't make any difference, or?
A screenshot is on the way...
Thanks
Mike |
|
| Back to top |
|
 |
|