- This topic has 0 replies, 1 voice, and was last updated 10 years, 2 months ago by mobio9471.
-
AuthorPosts
-
mobio9471MemberHi,
I am working on styling a dynamic list and encountered some problems with it.
First of all I built a basic list from mobione components where a fixed number of list items are added manually and placed a custom html widget on each list item. In each html widget div-elements are created. Each with its unique ID. Then I created a css file that sets the font-style, font- and background-color for each div-element.
Additionally the background-color is changed from JavaScript using
$(“<div-id>”).css(“background-Color”,”<new Color>”);This approach works fine !
In the next step I created a list containing one (template) list item that contains a custom html widget. The html widget itself contains some div-elements with unique ID each.
To create a number of list items to this list dynamicly, I used MobioneListBuilder.js provided by wayne.
This script searches for the list of a given ID, takes the template list item and clones it to the desired number of elements. And filles the elements with content provided by a custom array.
I modified the script the way that it creates an object for each div-element. Here I set the background color for each div by
<divObj>.css(“background-Color”,”green”);The problem is , that this has no effect on the look of the div elements.
Using the debugger I can see the background color property of the <divObj> set.
If I create an object for the list item itself, the approach
<itemObj>.css(“background-Color”,”green”);
works and sets the list item background-color as expected.Also I tried to set the background color of the div-elements from css file.
For test purpose I uncommented the line
list.delete();
in the script. Now the template list item is always displayed as the first list item.
The cloned items are added after it in the list.The css file has full effect on the first (template) item but no effect on the cloned ones.
What is the difference between adding a list item manually and adding it by JavaScript (MobioneListBuilder.js) from the css point of view ?
What is the problem with it ?
Please help me !
-
AuthorPosts