how to display a line number instead of the id?

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

how to display a line number instead of the id?

Post by amiens80 »

hi,

in list page, my first column is the ID (primary key). i display it because it is useful for me only (admin).
But the users wish only to have a line number in the list page instead of that id.
how to do that ?

if i use the row_renderer even, i can change the viewvalue but i don't know the current position of each id in the list.

any tips to perform such tweak display?

Have a great day


Bishu
User
Posts: 429

Post by Bishu »

u may use

$this->RowCount
//this will give the row number

mobhar
User
Posts: 11729

Post by mobhar »

Simply enable "Sequence number" option from "Table" setup -> "Table Options" -> "List Page", after that re-generate ALL the script files again.

amiens80
User
Posts: 450

Post by amiens80 »

hi,

ah super feature !

thank your for the tips !

in the server event, i add the ID on the title of each line, so i can hide the id field column and keep the value on tooltips for me !!

function ListOptions_Rendering() {
	
	$this->RowAttrs["title"] = $this->myid->CurrentValue;
}

amiens80
User
Posts: 450

Post by amiens80 »

hi again,

once we add this sequence column in the list view, can we "customize" the format and display ?

in the server event Row_Rendered(), can we change the display value like that :

$this->sequence->ViewValue="<strong>".$this->sequence->ViewValue."</strong>";


arbei
User
Posts: 9389

Post by arbei »

You may use:

$this->ListOptions["sequence"]->Body = "xxx";

By default the original value is just $this->RecordCount.

You may also customize the display by customizing this language phrase in the language file:

<phrase id="SequenceNumber" value="%s."/>

amiens80
User
Posts: 450

Post by amiens80 »

hi,

thank you for the reply.

ok, so i cannot customize the format ? by example, make the cell red (not the full TR , only the TD) depending on rsnew or rsold recordset value ?


arbei
User
Posts: 9389

Post by arbei »

Note that ListOption class has CssClass and CssStyle properties, you can set them according to your conditions.


Post Reply