Mashiane Expert Licensed User Longtime User Nov 9, 2020 #1 Ola I'm loading custom views with LoadLayoutArray. Each identifier of the element will be suffixed with _1, _2, _n? Perfect. Now I'd like to assign a data attribute to the elements e.g. btnSave, btnOpen, btnDelete with data-id=btnsave etc. This works. How can I get the reference to the element anywhere in my code by data attribute search? For example use something like B4X: dim el as BANanoElement = BANano.GetElement[ByDaya]("btnSave") Thanks
Ola I'm loading custom views with LoadLayoutArray. Each identifier of the element will be suffixed with _1, _2, _n? Perfect. Now I'd like to assign a data attribute to the elements e.g. btnSave, btnOpen, btnDelete with data-id=btnsave etc. This works. How can I get the reference to the element anywhere in my code by data attribute search? For example use something like B4X: dim el as BANanoElement = BANano.GetElement[ByDaya]("btnSave") Thanks
alwaysbusy Expert Licensed User Longtime User Nov 9, 2020 #2 The code you posted can never be written in the B4X IDE so that will never be an option. And why don't you just use the normal JavaScript selector? B4X: Dim dataIdTest As BANanoElement dataIdTest.Initialize("[data-id='btnsave']") Alwaysbusy Upvote 0
The code you posted can never be written in the B4X IDE so that will never be an option. And why don't you just use the normal JavaScript selector? B4X: Dim dataIdTest As BANanoElement dataIdTest.Initialize("[data-id='btnsave']") Alwaysbusy
Mashiane Expert Licensed User Longtime User Nov 9, 2020 #3 alwaysbusy said: dataIdTest.Initialize("[data-id='btnsave']") Click to expand... Perfect thanks. Now I know how I can apply normal javascript selectors in BANano. Upvote 0
alwaysbusy said: dataIdTest.Initialize("[data-id='btnsave']") Click to expand... Perfect thanks. Now I know how I can apply normal javascript selectors in BANano.