View Full Version : loading complicated form html not easily represented with extjs layouts

19 May 2009, 6:46 AM
I have a question about generating html. Obviously there are many ways of doing this.
here are some that I can think of:
1)to use javascript object to store html and concatonate json object into javascript.
2)use template or xtemplate(xtemplate doesn't work in ext2.2) object to load store into brace {} tags.
3)create custom extjs component form object with form,absolute, or some other layout.
4)some other method? is there any other way?

here is code sample:

var KEY=0,VALUE=1,NAME=2;
function createInputForm(htmlRef,store)
for(var c=0;c<store.length;c++)
htmlRef+='<b>field '+store[c][KEY]+':</b><input class=\"someextjscss\" name=\"'+store[c][NAME]+'\" type=\"text\" value=\"'+store[c][VALUE]+'\" /></br>';

19 May 2009, 6:50 AM
Huh? Create form Fields in a loop! Just as easy.

19 May 2009, 6:59 AM
for this example, yes (to make simple example), but if there is complicated html layout, then not as easy

i guess the question is can you mix html with extjs form variables without leaving the scope of extjs?

19 May 2009, 7:03 AM
When you say "complicated". What is the requirement?

19 May 2009, 7:04 AM
the requirement is to create a form that has html that is foreign to the capability of extjs layouts, or easier to accomplish by generating server side html with php/jsp/etc -- or concatonating strings of html in javascript..

this is matter of opinion maybe.

19 May 2009, 7:12 AM
So you don't want Ext, you want some other form of HTML.

That looks a bit different.

19 May 2009, 8:15 AM
you're right.

if extjs css is used then the html outputted will look almost the same (maybe/usually identical), but might be formatted slightly differently if it were coded in extjs. the styles won't match between the elements used in extjs and with plain html.