Skip to main content

output from java to jmaki

3 replies [Last post]
jdz99
Offline
Joined: 2008-11-07
Points: 0

I have a java class that outputs information like this,

IIterator dims = cube.getDimensions();
for (int i = 0; i < dims.getCount(); i++) {
IDimension dim = (IDimension)dims.getAt(i);
System.out.print(((i > 0) ? "," : "") + dim.getName());
}

How can I redirect the output to a dojo listbox with jmaki?

Thanks,
Jim

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi jim,

jMaki widgets in almost all cases will size to fit the html element they appear in.

In cases like what you have you can pass in the size as an arugment args="{ width : 500, height : 300}" but you will have to make sure the widget can handle those arguments.

We currently do not have a dojo listbox. We do have a dojo combobox though.

Were you looking for a list or a combobox?

jdz99
Offline
Joined: 2008-11-07
Points: 0

At this point I am trying to populate a dojo or yahoo table with the results of a array that gets returned. I have a myjs.js file where I build a string, sStr from an array that gets returned. How can I assign the string to the rows of a table...this does not work,

value="{columns: {'title':'Title',
rows:${sStr}"/>

thanks,
Pete

gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi,

So if you are doing this in JavaScript you will need to make sure your variables are scoped correctly (like to the window scrope) and you can then use clientside value bindings.

Example:

1) In your myjs.js get the data however makes sense to you using Ajax calls or any other means.
2) Assign the value to a variable like:

window.myvalue = {
columns : { 'id' : 'title', label : 'title' },
rows : sStr
}

Note: you will need to assign the full value for the widget (including column names)

3) Now in your JSP page use the following syntax:

value="@{window.myvalue}"/>

That is pretty much it. The @{} notation will look up a JavaScript scoped variable.

One thing to note is that your myjs.js will need to be declared *before* the widget in the page. You may also consider putting the code in your glue.js to insure it gets loaded at the right time. It needs to have loaded *before* the widget. If you are using Ajax calls to get your data you will need to make them *synchronous* to guarantee the data is ready before the widget is encountered in the page.

-Greg