[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-general
Subject: Re: [PEAR] Structures/Datagrid - sorting on field prior to display
From: Olivier Guilyardi <ojaiml () nerim ! net>
Date: 2006-12-30 1:06:28
Message-ID: 4595BB94.3070907 () nerim ! net
[Download RAW message or body]
Hi ScottZ,
Could you please fill a bug report with these detailed informations?
It's at: http://pear.php.net/bugs/report.php?package=Structures_DataGrid
That would help us to properly handle this issue.
Thanks for your feedback
Olivier
ScottZ a écrit :
> Hello Olivier,
>
> Not sure what is wrong then.
> I tried it with php 5.2.0 on my local windows box and on a remote unix
> box.
> I installed pear per normal and Structures/Datagrid with:
>
> pear install Structures_DataGrid-beta
> pear install --alldeps Structures_DataGrid-beta#datasources
> pear install --alldeps Structures_DataGrid-beta#renderers
>
> pear list shows:
> INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
> =========================================
> PACKAGE VERSION STATE
> Archive_Tar 1.3.1 stable
> Console_Getopt 1.2.1 stable
> Console_Table 1.0.5 stable
> DB 1.7.6 stable
> DB_DataObject 1.8.5 stable
> DB_DataObject_FormBuilder 1.0.0RC6 beta
> DB_Table 1.4.0 stable
> Date 1.4.7 stable
> HTML_Common 1.2.3 stable
> HTML_QuickForm 3.2.7 stable
> HTML_Table 1.7.5 stable
> MDB2 2.3.0 stable
> OLE 0.5 beta
> PEAR 1.4.11 stable
> Pager 2.4.3 stable
> Spreadsheet_Excel_Writer 0.9.1 beta
> Structures_DataGrid 0.8.0 beta
> Structures_DataGrid_DataSource_Array 0.1.1 beta
> Structures_DataGrid_DataSource_CSV 0.1.4 beta
> Structures_DataGrid_DataSource_DB 0.1.1 beta
> Structures_DataGrid_DataSource_DBQuery 0.1.4 beta
> Structures_DataGrid_DataSource_DBTable 0.1.5 beta
> Structures_DataGrid_DataSource_DataObject 0.1.1 beta
> Structures_DataGrid_DataSource_MDB2 0.1.3 beta
> Structures_DataGrid_DataSource_RSS 0.1.1 beta
> Structures_DataGrid_DataSource_XML 0.1.2 beta
> Structures_DataGrid_Renderer_CSV 0.1.3 beta
> Structures_DataGrid_Renderer_Console 0.1.1 beta
> Structures_DataGrid_Renderer_HTMLSortForm 0.1.2 beta
> Structures_DataGrid_Renderer_HTMLTable 0.1.3 beta
> Structures_DataGrid_Renderer_Pager 0.1.1 beta
> Structures_DataGrid_Renderer_Smarty 0.1.3 beta
> Structures_DataGrid_Renderer_XLS 0.1.1 beta
> Structures_DataGrid_Renderer_XML 0.1.2 beta
> Structures_DataGrid_Renderer_XUL 0.1.2 beta
> Validate 0.7.0 beta
> XML_Parser 1.2.8 stable
> XML_RPC 1.5.1 stable
> XML_RSS 0.9.10 beta
> XML_Serializer 0.18.0 beta
> XML_Util 1.1.4 stable
>
>
> Here's the CSV (now called names.csv)
>
> ln,fn,mi,num
> Jones,John,T,9034
> Allen,Mary,S,3045
> Smith,Anna,J,5074
> Castel,Ed,A,7043
>
> Here's the code:
>
> <?php
>
> # Init Pear Datagrid for use
> require_once 'Structures/DataGrid.php';
> $dg =& new Structures_DataGrid();
>
> $dgOptions["generate_columns"] = true;
> $dgOptions["header"] = true;
> $dgOptions["labels"] = array (
> "ln" => "Last",
> "fn" => "First"
> );
>
> $preSort["Last"] = "ASC";
>
> $result = $dg->setDefaultSort($preSort);
> if(PEAR::isError($result)) {
> echo $result->getMessage();
> }
>
> # Bind our csv file to the datagrid
> $result = $dg->bind("./names.csv", $dgOptions, "CSV");
> if(PEAR::isError($result)) {
> echo $result->getMessage();
> }
>
> $drOptions["numberAlign"] = false;
>
> $result = $dg->render("HTMLTable", $drOptions);
> if(PEAR::isError($result)) {
> echo $result->getMessage();
> }
>
> ?>
>
> First displayed page is:
>
> Last First mi num
> Allen Mary S 3045
> Castel Ed A 7043
> Jones John T 9034
> Smith Anna J 5074
>
> Click on "Last" the result is the same (should be DESC?):
>
> Last First mi num
> Allen Mary S 3045
> Castel Ed A 7043
> Jones John T 9034
> Smith Anna J 5074
>
> Click on "Last" again:
>
> Last First mi num
> Smith Anna J 5074
> Jones John T 9034
> Castel Ed A 7043
> Allen Mary S 3045
>
>
> Changed
> $preSort["Last"] = "ASC";
>
> to
> $preSort["Last"] = "DESC";
>
> Reload the page (still ASC?);
>
> Last First mi num
> Allen Mary S 3045
> Castel Ed A 7043
> Jones John T 9034
> Smith Anna J 5074
>
>
> Are the packages listed the correct versions I should be using?
>
> Many Thanks
> -Scott
>
>
>> -------- Original Message --------
>> Subject: Re: [PEAR] Structures/Datagrid - sorting on field prior to
>> display with csv data source?
>> From: Olivier Guilyardi <ojaiml@nerim.net>
>> Date: Thu, December 28, 2006 8:12 am
>> To: ScottZ <mylists@pinesalad.net>
>> Cc: pear-general@lists.php.net
>>
>> Hi Scottz
>>
>>> One very minor problem for me is that the column being sorted on isn't
>>> being tracked.
>>>
>>> For example, I'm sorting on my first column using setDefaultSort with
>>> ASC.
>>> This is called prior to the bind. Calling it after the bind and before
>>> the render wouldn't work.
>>>
>>> When the page is rendered the table is sorted correctly.
>>> If I click on the header for my first column, it will refresh the page
>>> with what I beleive is another ASC sort. It doesn't swith to DESC.
>>>
>>> You need to click twice on the column for it to switch direction in this
>>> case.
>> I can't reproduce this behaviour. I tried with the example you provide. It works
>> fine under both PHP4 and PHP5.
>>
>>> Second issue is I can't get DESC to work. It isn't a major problem for
>>> me as I need ASC, but I wanted to test things out to make sure I have
>>> done things correctly.
>> With your example I can sort in both directions.
>>
>> Please ensure that you are using the latest versions of:
>> - Structures_DataGrid
>> - Structures_DataGrid_DataSource_Array
>> - Structures_DataGrid_DataSource_CSV
>> - Structures_DataGrid_Renderer_HTMLTable
>>
>> Regards,
>>
>> --
>> Olivier
>
>
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic