Calculations in JS data grids
Bruno Del Sol
bruno.delsol at bydesign.fr
Wed Jul 25 16:56:53 EDT 2018
Hi Will,
I'm afraid JS data grid columns don't have calculations.
What you can do instead is use the $columnmode kJsDataGridModeCustomFormat which then allows you to write html instead
of the normal column value per each cell, in a special method named $formatcell.
For the full reference see page 135 of the webdev manual or this example lib
https://developer.omnis.net/libraries/format-cell
Here's a sample :
$formatcell
---------------
;; MUST be named $formatcell and be a child method of the datagrid widget
:: MUST be client-side
;; takes 2 parameters
;; pline Var ;the current list line when constructing the grid
;; pcol Var ;the current list column when constructing the grid
If pcol=1 ;; we want to override the value of the first column
Begin text block
Text: {<span> [pick(iList.[pline].status,'active','disabled','completed')] </span>}
End text block
Get text block html
Quit method html
End If
Of course, since this method wil run per each line and column, it is probably a good idea to keep it short and use it
only on small lists having few columns ...
HTH
Regards
Bruno
PS : I just spent a couple of days in Croyde Bay last week, and really enjoyed the chill out atmosphere of North Devon
after the crowded, noisy and overheated London.
By Design
http://www.bydesign.fr
Bruno Del Sol
bruno.delsol at bydesign.fr
tel (33) 01 48 78 47 37
46, rue de La Tour d'Auvergne
75009 Paris (France)
Le 25/07/2018 à 17:44, will via omnisdev-en a écrit :
> Hi List,
>
> In thick client Omnis a column in a headed list field can be given a calculation such as a pick() or con(), we use this quite a lot to translate integer data...
>
> i.e. when iList.status is 1 we see 'disabled' using this: pick(iList.status,'active','disabled','completed')
>
> For JS Data Grids it seems we are forced to map to a specific column in the list using $columndatacol, so the user sees the int value rather than the translation.
>
> Has anyone found a way to manipulate the text of a list in a remote form using an Omnis calc, or perhaps JS code? or are we forced to add another column to the list and manually translate to text before displaying it?
>
>
> Best regs...
>
> Will
>
>
> Will Adkin / Software Development Manager
> will.adkin at lineal.co.uk <mailto:will.adkin at lineal.co.uk>
>
> <mailto:will.adkin at lineal.co.uk>Lineal Software Solutions
> 01271 375999
> Unit 7, Riverside Court, Castle Street
> Barnstaple, Devon, EX31 1DR
> www.lineal.co.uk <http://www.lineal.co.uk/>
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>
More information about the omnisdev-en
mailing list