Ola
Assuming you have this code defined?
Q1: How can you get the dataObject via BANano without having to write an additional function like
Assuming that you want to access and perform some CRUD on the object?
I've tried..
It returns and illegal return statement?
Q2: If I define my object directly via code, how do I assign it to an html data attribute? For example.
In HTML...
I understand that BANano returns _dataobj globally or this is the wrong name?, is it possible to assign the object defined via code to an HTML data attribute?
Q3: The same applies for subs.
How do I
I understand that perhaps I need to define a callback with or maybe not.
But how do I get the html to know that we have a banano sub named "myControllerCode"?
Thanks.
Assuming you have this code defined?
B4X:
#if javascript
var dataObj = {
"records":[
{"CustomerName":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"},
{"CustomerName":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Around the Horn","City":"London","Country":"UK"},
{"CustomerName":"B's Beverages","City":"London","Country":"UK"},
{"CustomerName":"Berglunds snabbköp","City":"Luleå","Country":"Sweden"},
{"CustomerName":"Blauer See Delikatessen","City":"Mannheim","Country":"Germany"},
{"CustomerName":"Blondel père et fils","City":"Strasbourg","Country":"France"},
{"CustomerName":"Bólido Comidas preparadas","City":"Madrid","Country":"Spain"},
{"CustomerName":"Bon app'","City":"Marseille","Country":"France"},
{"CustomerName":"Bottom-Dollar Marketse","City":"Tsawassen","Country":"Canada"},
{"CustomerName":"Cactus Comidas para llevar","City":"Buenos Aires","Country":"Argentina"},
{"CustomerName":"Centro comercial Moctezuma","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"},
{"CustomerName":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"}
]};
Q1: How can you get the dataObject via BANano without having to write an additional function like
B4X:
function getDataObject () {
return dataObj;
};
Assuming that you want to access and perform some CRUD on the object?
I've tried..
B4X:
Dim dataObject As BANanoObject = BANano.Eval("return dataObj;")
It returns and illegal return statement?
Q2: If I define my object directly via code, how do I assign it to an html data attribute? For example.
B4X:
Dim dataObj As Map = CreateMap()
dim records As List
records.Initialize
records.Add(CreateMap("CustomerName": "Alfreds Futterkiste", "City": "Berlin", "Country": "Germany"))
records.Add(CreateMap("CustomerName": "Ana Trujillo Emparedados y helados", "City": "México D.F.", "Country": "Mexico"))
records.Add(CreateMap("CustomerName": "Antonio Moreno Taquería", "City": "México D.F.", "Country": "Mexico"))
dataObject.Put("records", records)
In HTML...
B4X:
<div data-anele="dataObj"></div>
I understand that BANano returns _dataobj globally or this is the wrong name?, is it possible to assign the object defined via code to an HTML data attribute?
Q3: The same applies for subs.
B4X:
Sub myControllerCode(xxx as string)
Do_1_2_3
End Sub
How do I
B4X:
<table controller="myControllerCode">
I understand that perhaps I need to define a callback with or maybe not.
B4X:
Dim xxx as object
Dim cb as BananoObject = BANano.CallBack(Me, "myControllerCode", array(xxx))
But how do I get the html to know that we have a banano sub named "myControllerCode"?
Thanks.