Sort Detail Tables, Display Fields

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
FedeLopez
User
Posts: 107

Sort Detail Tables, Display Fields

Post by FedeLopez »

Hi all... I have Master Table and Detail Table ID related...
I'd set up Lookup Table, Link Field (ID), Display Field 1 (LastName1), Display Field 2(LastName2), Display Field 3(Names), Display Field 4(DocNumber)

And in List_Page - Page Load set:

$this->id_field->DisplayValueSeparator = [", "];

This should hide Display Fields 3 & 4 on List page, but still see 4 fields in dropdown list, on ADD/Edit pages...
And actually it works, but...

When I get DetailTableList?showmaster=MasterTable
And I decide to sort persons, then display fields, appears, and separated by ", "...

So, where should I set the $this->id_field->DisplayValueSeparator = [", "]; (instead of Page_Load) to avoid get ruined when I sort the detail table list?

Or, maybe, there is another way to sort detail table.
But in this case I have only ID, that bring Last Name from a third table... So in Sort cant chose LastName...

Thanks in advance...


arbei
User
Posts: 9384

Post by arbei »

Note that the field values are sorted by database values by default. If you want to sort by display values, you may enable Lookup Table -> Allow sort/search.


mobhar
User
Posts: 11727

Post by mobhar »

FedeLopez wrote:

So, where should I set the $this->id_field->DisplayValueSeparator = [", "]; (instead of Page_Load) to avoid get ruined when I sort the detail table list?

You may use Row_Rendering server event.


FedeLopez
User
Posts: 107

Post by FedeLopez »

arbei wrote:

Note that the field values are sorted by database values by default. If you want to sort by display values, you may enable Lookup Table -> Allow sort/search.

Indeed... that is ok and working fine... but then Display Fields broken... P.e.
I got this as default... ordered by id (hiden).
I can't chose Last Name to be ordered initially, because is people table data... in this table (workers) I'd just store pepople id.

Workers
Iorio, Liliana Maria
Retegui, Liliana Beatriz
Lazzeri, Patricia Emilia
Roldan, Omar Tristan
Garaguso, Delia Elena

In Select Dropdown, when add/edit I show also Secondary Last Name & Doc Number (if exists), to rule out homonyms.
Iorio Eliceche, Liliana Maria (10797865)
Retegui, Liliana Beatriz
Lazzeri De Menditte, Patricia Emilia (11598838)
Roldan, Omar Tristan
Garaguso, Delia Elena.

but, then, if i want workers ordered alphabetically, I click on column header and get

Workers
Garaguso, Delia Elena, ,
Iorio, Liliana Maria, 10797865, Eliceche
Lazzeri, Patricia Emilia, 11598838, De Menditte
Retegui, Liliana Beatriz, ,
Roldan, Omar Tristan, ,

See? Order is ok... but hiden fields show up... because the DisplayValueSeparator is gone... I don't know why.


FedeLopez
User
Posts: 107

Post by FedeLopez »

mobhar wrote:

You may use Row_Rendering server event.

Mmmm... tried, but didn't work...


arbei
User
Posts: 9384

Post by arbei »

You need to set DisplayValueSeparator in the Grid page also. (Detail records are shown in the Grid page, not List page.)


FedeLopez
User
Posts: 107

Post by FedeLopez »

Table-Specific - Detail Grd Page have:
ListOptions_Load (Tried, didn't work)
ListOptions_Rendering (Tried didn't work)
ListOptions_Rendered (Tried didn't work)

But, I'd tried in Detail Table...
I should try in Master Table? maybe with Container(Detail_Table)->Field->DisplaySeparetValue... ?

Anyway... I'd solved it creating a Customfield concat(lastname,names,dni), then use that custom field in list and hide original id field, used only for add/edit lookup.


arbei
User
Posts: 9384

Post by arbei »

FedeLopez wrote:

I should try in Master Table? maybe with Container(Detail_Table)->Field->DisplaySeparetValue... ?

You should use Container("<DetailTable>Grid").


Post Reply