Page 1 of 2
Tabulator Array JS
Posted: Thu Feb 20, 2020 7:37 pm
by skinkairewalker
hello everyone !!
have a way to insert line like this > " {id:1, partida:"Desportiva Ferroviaria X Itapemirim", data:"20/02/2020", hora:"20:15", casa:1.91, emp:3.32, fora:3.46, amb:1.75, plusonefive:1.18,plus:"Ver Mais" , gender:"Brazil: Campeonato Capixaba"} " individually with array.add or using SB native commands ?
code >
Code: Select all
Tabulator::SetAttribute2(#myTabulatorGadget, Tabulator::#TabulatorColumns, Columns())
Protected SampleData
! v_sampledata = [
! {id:1, partida:"Desportiva Ferroviaria X Itapemirim", data:"20/02/2020", hora:"20:15", casa:1.91, emp:3.32, fora:3.46, amb:1.75, plusonefive:1.18,plus:"Ver Mais" , gender:"Brazil: Campeonato Capixaba"},
! {id:2, partida:"Estrela do Norte X Linhares", data:"20/02/2020", hora:"20:15", casa:1.53, emp:3.81, fora:4.98, amb:1.89, plusonefive:1.18,plus:"Ver Mais" , gender:"Brazil: Campeonato Capixaba"},
! {id:3, partida:"Serra X SAO Mateus", data:"20/02/2020", hora:"20:15", casa:1.54, emp:3.61, fora:5.35, amb:2.13, plusonefive:1.26,plus:"Ver Mais" , gender:"Brazil: Campeonato Capixaba"},
! {id:4, partida:"Boavista X Flamengo RJ", data:"22/02/2020", hora:"18:00", casa:11.3, emp:6.54, fora:1.16, amb:"", plusonefive:"",plus:"Ver Mais" , gender:"Brazil: Campeonato Carioca"},
! ];
Tabulator::SetAttribute(#myTabulatorGadget, Tabulator::#TabulatorData, SampleData)
Re: Tabulator Array JS
Posted: Fri Feb 21, 2020 8:02 am
by Peter
For example, you can use LinkedLists:
Code: Select all
Structure sItem
id.s
partida.s
xdata.s
hora.s
casa.s
emp.s
fora.s
amb.s
plusonefive.s
plus.s
gender.s
EndStructure
NewList Items.sItem()
AddElement(Items())
Items()\id = "1"
Items()\partida = "Desportiva Ferroviaria X Itapemirim"
Items()\xdata = "20/02/2020"
Items()\hora = "20:15"
Items()\casa = "1.91"
Items()\emp = "3.32"
Items()\fora = "3.46"
Items()\amb = "1.75"
Items()\plusonefive = "1.18"
Items()\plus = "Ver Mais"
Items()\gender = "Brazil: Campeonato Capixaba"
AddElement(Items())
Items()\id = "2"
Items()\partida = "Estrela do Norte X Linhares"
Items()\xdata = "20/02/2020"
Items()\hora = "20:15"
Items()\casa = "1.53"
Items()\emp = "3.81"
Items()\fora = "4.98"
Items()\amb = "1.89"
Items()\plusonefive = "1.18"
Items()\plus = "Ver Mais"
Items()\gender = "Brazil: Campeonato Capixaba"
; ... and so on
Define SampleData.s
CreateJSON(0)
InsertJSONList(JSONValue(0), Items())
SampleData = ComposeJSON(0)
FreeJSON(0)
Debug SampleData
Please note: There is a
data property in your JSON. The SpiderBasic IDE recognizes
data as a keyword and converts it to
Data (with a capital 'D').
If it is somehow possible, you should use a different name for '
data' or
you can outsource the structure to an external file.
Greetings ... Peter
Re: Tabulator Array JS
Posted: Sat Feb 22, 2020 5:34 pm
by skinkairewalker
Peter wrote:For example, you can use LinkedLists:
Code: Select all
Structure sItem
id.s
partida.s
xdata.s
hora.s
casa.s
emp.s
fora.s
amb.s
plusonefive.s
plus.s
gender.s
EndStructure
NewList Items.sItem()
AddElement(Items())
Items()\id = "1"
Items()\partida = "Desportiva Ferroviaria X Itapemirim"
Items()\xdata = "20/02/2020"
Items()\hora = "20:15"
Items()\casa = "1.91"
Items()\emp = "3.32"
Items()\fora = "3.46"
Items()\amb = "1.75"
Items()\plusonefive = "1.18"
Items()\plus = "Ver Mais"
Items()\gender = "Brazil: Campeonato Capixaba"
AddElement(Items())
Items()\id = "2"
Items()\partida = "Estrela do Norte X Linhares"
Items()\xdata = "20/02/2020"
Items()\hora = "20:15"
Items()\casa = "1.53"
Items()\emp = "3.81"
Items()\fora = "4.98"
Items()\amb = "1.89"
Items()\plusonefive = "1.18"
Items()\plus = "Ver Mais"
Items()\gender = "Brazil: Campeonato Capixaba"
; ... and so on
Define SampleData.s
CreateJSON(0)
InsertJSONList(JSONValue(0), Items())
SampleData = ComposeJSON(0)
FreeJSON(0)
Debug SampleData
Please note: There is a
data property in your JSON. The SpiderBasic IDE recognizes
data as a keyword and converts it to
Data (with a capital 'D').
If it is somehow possible, you should use a different name for '
data' or
you can outsource the structure to an external file.
Greetings ... Peter
thanks this working fine !!
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 3:56 am
by skinkairewalker
how can i get a values from clicked row ?
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 6:00 am
by Peter
skinkairewalker wrote:how can i get a values from clicked row ?
in your case:
Code: Select all
Procedure TabulatorEvents(o)
Select EventType()
Case Tabulator::#EventType_RowClick
Debug "#EventType_RowClick"
Protected SelectedRow.sItem
! v_selectedrow = v_o.row.row.data;
; now you can work with SelectedRow
Case ....
[...]
EndSelect
EndProcedure
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 4:09 pm
by skinkairewalker
Peter wrote:skinkairewalker wrote:how can i get a values from clicked row ?
in your case:
Code: Select all
Procedure TabulatorEvents(o)
Select EventType()
Case Tabulator::#EventType_RowClick
Debug "#EventType_RowClick"
Protected SelectedRow.sItem
! v_selectedrow = v_o.row.row.data;
; now you can work with SelectedRow
Case ....
[...]
EndSelect
EndProcedure
but how can i print values ?
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 4:23 pm
by Peter
skinkairewalker wrote:but how can i print values ?
what do you mean by "print values"? Printing with a printer?
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 5:08 pm
by skinkairewalker
print on debug , like > Debug(SelectedRow.id)
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 5:11 pm
by skinkairewalker
screenshot >
https://prnt.sc/r70747
code >
Code: Select all
Procedure TabulatorEvents(o)
Select EventType()
Case Tabulator::#EventType_RowClick
Debug "#EventType_RowClick"
Protected SelectedRow.sItem
Protected Items.s
! v_selectedrow = v_o.row.row.data;
! v_items=v_selectedrow;
Debug SelectedRow
Debug items
Case Tabulator::#EventType_RowDblClick
Debug "#EventType_RowDblClick"
Case Tabulator::#EventType_RowContext
Debug "#EventType_RowContext"
Default
Debug "EventType(): " + EventType()
EndSelect
Debug "---------------------------"
EndProcedure
Re: Tabulator Array JS
Posted: Mon Feb 24, 2020 5:27 pm
by Peter
Code: Select all
[...]
Case Tabulator::#EventType_RowClick
Debug "#EventType_RowClick"
Protected SelectedRow.sItem
! v_selectedrow = v_o.row.row.data;
Debug SelectedRow\id
Debug SelectedRow\partida
Debug SelectedRow\xdata
Debug SelectedRow\hora
Debug SelectedRow\casa
Debug SelectedRow\emp
Debug SelectedRow\fora
Debug SelectedRow\amb
Debug SelectedRow\plusonefive
Debug SelectedRow\plus
Debug SelectedRow\gender