NG Datagrid scripting the column valuelist

Questions, tips and tricks and techniques for scripting in Servoy

NG Datagrid scripting the column valuelist

Postby jwalsh216 » Wed Apr 17, 2019 4:32 am

I'm trying to script the building of an NG Datagrid and have a problem adding a column with a valuelist. If I use something like below the grid does not render.
Code: Select all
var column =  elements.data_grid.newColumn("my_column");
column.valuelist = "my_valuelist";


If I build a datagrid with a column that has a valuelist in the form builder it works. When I output the value of the valuelist property of the column it's "my_valuelist". I've also tried setting it with application.getValueListItems("my_valuelist") and that also does not work.

Thanks,
Jason
jwalsh216
 
Posts: 3
Joined: Fri Feb 08, 2019 8:57 pm

Re: NG Datagrid scripting the column valuelist

Postby Gabi Boros » Wed Apr 17, 2019 3:05 pm

it should work to set it with the valuelist name (column.valuelist = "my_valuelist");
I quickly tried that, created a custom valuelist with text real value type, a new column with a text type dataprovider and with editType = 'COMBOBOX';
when I edit the cell, I do see the combo with the values
Gabi Boros
Servoy
Gabi Boros
 
Posts: 343
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: NG Datagrid scripting the column valuelist

Postby jwalsh216 » Wed Apr 17, 2019 3:54 pm

Thanks Gabi

I'm getting closer. I was building the datagrid in the onLoad of a form. This was not working, the grid is rendered but without applying the valuelist. I moved it to the onShow of the form instead. It still doesn't work on the firstShow, but the second time onShow is called it renders with the valuelist applied as expected.
jwalsh216
 
Posts: 3
Joined: Fri Feb 08, 2019 8:57 pm

Re: NG Datagrid scripting the column valuelist

Postby Gabi Boros » Wed Apr 17, 2019 4:04 pm

hm, I created the column onload, and it did show up (I do use the latest ng grid, from github/master and Servoy 2019.03).
when in developer, try to stop the running client (terminate in the debug view), to make sure onload is called
Gabi Boros
Servoy
Gabi Boros
 
Posts: 343
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: NG Datagrid scripting the column valuelist

Postby jwalsh216 » Wed Apr 17, 2019 4:23 pm

I've found this error in the logs.

Code: Select all
java.lang.NullPointerException: null
at com.servoy.j2db.server.ngclient.property.types.ValueListTypeSabloValue.detach(ValueListTypeSabloValue.java:457) ~[?:?]
at com.servoy.j2db.server.ngclient.property.FoundsetLinkedTypeSabloValue.detach(FoundsetLinkedTypeSabloValue.java:325) ~[?:?]
at org.sablo.specification.property.ChangeAwareMap.detach(ChangeAwareMap.java:389) ~[sablo_2019.3.0.3412.jar:?]
at org.sablo.specification.property.ChangeAwareMap.detach(ChangeAwareMap.java:370) ~[sablo_2019.3.0.3412.jar:?]
at org.sablo.specification.property.ChangeAwareList.detach(ChangeAwareList.java:481) ~[sablo_2019.3.0.3412.jar:?]
at org.sablo.specification.property.ChangeAwareList.detach(ChangeAwareList.java:462) ~[sablo_2019.3.0.3412.jar:?]
at org.sablo.BaseWebObject.onPropertyChange(BaseWebObject.java:863) ~[sablo_2019.3.0.3412.jar:?]
at org.sablo.BaseWebObject.setProperty(BaseWebObject.java:643) ~[sablo_2019.3.0.3412.jar:?]
at com.servoy.j2db.server.ngclient.component.RuntimeWebComponent.put(RuntimeWebComponent.java:469) ~[?:?]
at org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:2544) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1712) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1706) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1258) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:399) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3534) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107) ~[org.eclipse.dltk.javascript.rhino_2019.3.0.3412.jar:?]
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:665) [servoy_shared_2019.3.0.3412.jar:?]
at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:393) [servoy_debug_2019.3.0.3412.jar:?]
at com.servoy.j2db.BasicFormController.executeFunction(BasicFormController.java:1074) [servoy_shared_2019.3.0.3412.jar:?]
at com.servoy.j2db.BasicFormController.executeFormMethod(BasicFormController.java:790) [servoy_shared_2019.3.0.3412.jar:?]
at com.servoy.j2db.BasicFormController.executeOnShowMethod(BasicFormController.java:658) [servoy_shared_2019.3.0.3412.jar:?]
at com.servoy.j2db.BasicFormController.access$2(BasicFormController.java:651) [servoy_shared_2019.3.0.3412.jar:?]
at com.servoy.j2db.BasicFormController$1.run(BasicFormController.java:387) [servoy_shared_2019.3.0.3412.jar:?]
at org.sablo.eventthread.Event$1.run(Event.java:102) [sablo_2019.3.0.3412.jar:?]
at org.sablo.websocket.CurrentWindow.runForWindow(CurrentWindow.java:77) [sablo_2019.3.0.3412.jar:?]
at org.sablo.eventthread.Event.execute(Event.java:92) [sablo_2019.3.0.3412.jar:?]
at org.sablo.eventthread.EventDispatcher.dispatch(EventDispatcher.java:125) [sablo_2019.3.0.3412.jar:?]
at org.sablo.eventthread.EventDispatcher.run(EventDispatcher.java:89) [sablo_2019.3.0.3412.jar:?]
at com.servoy.j2db.server.ngclient.eventthread.NGEventDispatcher.run(NGEventDispatcher.java:55) [servoy_ngclient_2019.3.0.3412.jar:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
jwalsh216
 
Posts: 3
Joined: Fri Feb 08, 2019 8:57 pm

Re: NG Datagrid scripting the column valuelist

Postby Gabi Boros » Thu Apr 18, 2019 11:16 am

is this reproducible? can you create a case in our support system ( https://support.servoy.com ) with a sample, or at least a code snippet of onload and onshow?
Gabi Boros
Servoy
Gabi Boros
 
Posts: 343
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania


Return to Methods

Who is online

Users browsing this forum: No registered users and 0 guests