Dynamic generated Elements (Buttons, Checkbox, ..)

Discussion forum about all things TD Mobile.
Ronson
Austria
Posts: 1
Joined: 12 Jul 2018, 10:54
Location: Austria

Dynamic generated Elements (Buttons, Checkbox, ..)

Post by Ronson » 12 Jul 2018, 11:05

Hello Community,

ive got a question about dynamic generated Elements (Buttons, checkboxes, ...).
Is there a function for inizialize generated Buttons from js or something that rebuilds the page with the new Elements and styles them correctly?

Ive created a HTML Control Element as a Container for the generated Elements.
Then i generate the Elements after a serverfunction in a JavaScript function.
Im creating in a for Loop the TD Bindings, TD Controls, then the HTML Elements and appending this to my Container DIV Element.
It works but the Visuals/Styling is wrong.

Heres how the Checkbox Looks, the first is the generated, the second is a normal one.
The Input from the Generated is beside the Checkbox and Input from the normal Checkbox is invisible and so:

Image

Code: Select all

		new Td.Data.Binding(
			"s"+i,
			"String",
			{
				boolstate: {
					booltype: "DoesntEqualValue",
					compareval: ""
				},
				initval: ""
			}
		);			
		new Td.Controls.Label(
			"bgt"+i,
			{
			}
		);					
		new Td.Controls.TextBox(
			"df"+i,
			{
				binding: { "source": "s"+i, "direction": "getset" },
			}
		);
		new Td.Controls.LayoutGrid(
			"lg"+i,
			{
			}
		);
		
		//Generiere HTML Elemente und füge sie zum Content hinzu
		var ct1 = '<div class="ui-grid-a" id="lg' + i + '">'
		var ct2 = '<div class="ui-block-a">'
		var ct3 = '<div id="bgt' + i + '" style="overflow:hidden;">'+	tasks[i].kopf_match +'</div>'
		var ct4 = '</div>'
		var ct5 = '<div class="ui-block-b">'
		var ct6 = '<div id="df' + i + '_container" class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset">'
		var ct7 = '<input id="df' + i + '" type="text" />'
		var ct8 = '</div>'
		var ct9 = '</div>'
		var ct10= '</div>'
		var neuerContent = ct1 + ct2 + ct3 + ct4 + ct5 +ct6 + ct7 + ct8 + ct9 + ct10;
		$( "#Content" ).append( neuerContent );

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 1 guest