Undefined datagrid customformat column
Martin Obongita
martin.obongita at yahoo.com
Wed Oct 30 16:23:22 UTC 2024
Hi Michael,
First,The datagrid object has this formatcell client method:
Calculate lValue as iList.[pRow].[pCol]
If pCol<>1
Calculate lValue as jst(lValue,'n2')
End If
# note, client executed method requires color parameter to be a string unless using a constant. Can alternativley be a HTML color string eg. '#FF0000'
If iList.[pRow].iTotal<0
# Calculate iHtml as styledtohtml(con(style(kEscColor,'#FF0000'),style(kEscStyle,kBold),lValue))
Calculate iHtml as styledtohtml(con(style(kEscColor,'rgba(255,0,0,1)'),style(kEscStyle,kBold),lValue))
Else
Calculate iHtml as styledtohtml(con(style(kEscColor,kDarkGreen),style(kEscStyle,kItalic),lValue))
End If
Quit method iHtml
Second,
Do iList.$define(iMonth,iMoneyIn,iMoneyOut,iTotal)
versus,
Do iList.$definefromsqlclass($tables.person)
Could any of these cause issues with the display in a datagrid?I hope the formatting of text comes through with correct paragraphs.
Regards,Martin.
On Wednesday, October 30, 2024 at 07:01:15 PM GMT+3, Michael Monschau <michael at brainydata.co.uk> wrote:
Hi Martin,
I apologise, I misunderstood and went on a tangent where my memory went down the complex grid route, somewhat different (busy getting ready for EurOmnis). I must admit I never looked at the jsDataGrid sample library, but I do use the datagrid in my presentation, both js-client and desktop.
Firstly: I am not sure what you mean when you say "change the list definition from instance variables and instead define it from a sql table”. The list (defined from a table or otherwise) must be an instance variable or the client doesn’t see it.
Secondly: If I set $dataname to a SQL list and turn on $userdefined, I set as a minimum $columnname and $columndatacol for each column I intend to display. That works for me. When I do that I can edit data no problem.
The scenario you are describing I have not come across and I don’t know what could be causing it. Have the columns additional formatting set which may not be compatible with the data from your SQL list?
One thought I had: Because my SQL lists are also obviously smartlists (otherwise you could not use $dowork and related), smart-lists do not work on the client. All the smart stuff is lost when sent to the client. Consequently when the data in a column is changed and the list is sent back to the server your list will now be an ordinary list. This is in fact a subject I will be talking about in my JSON control sessions. What I do is, I make a copy of the SQL list which is a task var and the copy is an instance var. I then ensure that when data in a cell is changed I send a message to the server and apply this change to the SQL list.
Perhaps this is where it is going wrong for you. I hope I have put it well enough so it makes sense.
Kind regards,
Michael
Brainy Data Limited
The Home for Omnis components
Web: www.brainydata.com
GitHub: https://github.com/BrainyData
> On 29 Oct 2024, at 10:35, Michael Monschau <michael at brainydata.co.uk> wrote:
>
> Hi Martin,
>
> I will actually be demoing this very scenario at EurOmnis, although I am not using custom-formatting with the datagrid!
>
> I would suspect you need to change the custom format definitions from <instance_var_name> to <list_name.instance_var_name>.
>
> Regards,
> Michael
>
>
> sent from my iPad
>
>> On 29 Oct 2024, at 09:19, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>>
>>
>> Dear All,
>>
>> I’m working on the sample library jsDataGrid Formatting. I noticed that if I change the list definition from instance variables and instead define it from a sql table class, the data entered into the datagrid columns change to “undefined”. If I tab out of the column entry and back again into the entry column, the previous data entered is visible. If I tab out the entry cell it changes to “undefined”. What could be causing this?
>>
>> The datagrid object is in a js remote form.
>>
>> Regards
>>
>> Martin O.
>>
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list