how to refresh ABMTable ?
code ConnectPage()
in Sub pagination_PageChanged(OldPage As Int, NewPage As Int)
code Class custom
error log when pagination_PageChanged
code ConnectPage()
B4X:
Dim nPAGE as int=1
Dim tbl1 As ABMTable
tbl1=custom.makeTable (nPAGE)
page.Cell(2,1).AddComponent(tbl1)
in Sub pagination_PageChanged(OldPage As Int, NewPage As Int)
B4X:
Dim pagination As ABMPagination = page.Component("pagination")
pagination.SetActivePage(NewPage) ' IMPORTANT!
pagination.Refresh
'
Dim tbl As ABMTable = page.Cell(2,1).Component("tbl1")
tbl=custom.makeTable (NewPage)
tbl.Refresh :' here crash ... see log error!
code Class custom
B4X:
Sub MakeTable (nPage As Int) As ABMTable
Dim tbl1 As ABMTable
tbl1.Initialize(page,"tbl1",True,False,True,"")
tbl1.Clear
tbl1.SetHeaders(Array As String("Cognome", "Nome"))
tbl1.SetColumnDataFields(Array As String("Cognome", "Nome"))
'here sql select from my database
' .....
' ......
Do While rec.NextRow
' here making a table
Dim r As List
Dim rCellThemes As List
r.Initialize
rCellThemes.Initialize
r.Add(cognome)
rCellThemes.Add("nocolor") ' nocoloredit
r.Add(nome)
rCellThemes.Add("nocolor")
tbl1.AddRow(idcliente, r) :' idcliente
tbl1.SetRowThemes(rCellThemes) ' make sure you have as many items in rCellThemes as in r!
Loop
'close ResultSet and SQL
rec.Close
sql.Close
Return tbl1
End Sub
error log when pagination_PageChanged
B4X:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:119)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4j.object.WebSocketModule$Adapter$1.run(WebSocketModule.java:126)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4j.object.WebSocketModule$Adapter$ThreadHandler.run(WebSocketModule.java:191)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:496)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:450)
at manuale.gm.com.tabella._page_parseevent(tabella.java:300)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:119)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
... 17 more
Caused by: java.lang.NullPointerException
at com.ab.abmaterial.ABMTable.GetActiveTableRow(Unknown Source)
at com.ab.abmaterial.ABMTable.GetActiveRow(Unknown Source)
at com.ab.abmaterial.ABMTable.RefreshInternal(Unknown Source)
at com.ab.abmaterial.ABMTable.Refresh(Unknown Source)
at manuale.gm.com.tabella._pagination_pagechanged(tabella.java:350)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
... 18 more