Page 1 of 1

Sort Detail Tables, Display Fields

Posted: Fri Feb 02, 2024 12:23 am
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...


Re: Sort Detail Tables, Display Fields

Posted: Fri Feb 02, 2024 9:36 am
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.


Re: Sort Detail Tables, Display Fields

Posted: Fri Feb 02, 2024 9:38 am
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.


Re: Sort Detail Tables, Display Fields

Posted: Fri Feb 02, 2024 9:05 pm
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.


Re: Sort Detail Tables, Display Fields

Posted: Fri Feb 02, 2024 9:09 pm
by FedeLopez

mobhar wrote:

You may use Row_Rendering server event.

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


Re: Sort Detail Tables, Display Fields

Posted: Sat Feb 03, 2024 10:50 am
by arbei

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


Re: Sort Detail Tables, Display Fields

Posted: Thu Feb 08, 2024 12:33 am
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.


Re: Sort Detail Tables, Display Fields

Posted: Thu Feb 08, 2024 9:14 am
by arbei

FedeLopez wrote:

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

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