aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Javascript: dynamic query/condition build help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript: dynamic query/condition build help" Watch "Javascript: dynamic query/condition build help" New topic
Author

Javascript: dynamic query/condition build help

Sridhar Ranganthan
Ranch Hand

Joined: Mar 12, 2009
Posts: 35
hi all,

iam creating dynamic button using javascript via kony.

function dynaButton()
{

var layoutprop={ widgetdatamap {"btn1" : "btn1", "btn2" : "btn2"}};


}
i would like to create n no of buttons,so in that case "btn1" : "btn1", "btn2" : "btn2","btn3" : "btn3", "btn4" : "btn4"..."btnn" : "btnn"


i have tried in this approach

var myId;
function getId()
{

for(var i=1;i<n;i++)
{
myId=myId+"btn"+i+":btn"+i;
if(i<n)
{
myId=myId+",";
}
return myId;
}

and then i have placed like this

var getBtnId=getId();

var layoutprop={ widgetdatamap {getBtnId}};

but it return error, i guess ,it cause of : operator .

can you please how to sort out this problem.

i want to place "btn1" : "btn1" , "btn2" : "btn2" in { widgetdatamap { } }


Thanks,
Sridhar.R
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Use an object! Do not build an object from a string.



Eric
Sridhar Ranganthan
Ranch Hand

Joined: Mar 12, 2009
Posts: 35
HI,

Thank you for your reply,

can you explain more that will helpful for me.

Thanks,
Sri.R
Sridhar Ranganthan
Ranch Hand

Joined: Mar 12, 2009
Posts: 35



Iam going to create dynamic button,so inside "widgetDataMap" i have to put "button1": "button1","button2":"button2"...."buttonn":"buttonn"

if dynamic button count is 5 i have to create "button1":"button1"....."button5":"button5" and assign into




Help me the same.

Regards,
Sridhar.R
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript: dynamic query/condition build help