How to display content dynamically base on the menu selection?

I have only one XML file to populate my menus and display the
content base on the menu selection.
If I select anything by name on the menus, example Math all
the the Math products will display on the dsFeatures region.
I use istinctOnLoad: true, distinctFieldsOnLoad:['name']
function to remove duplicate rows from the data set when it loads.
So far so good.
Once I try to select from the grades menu this does not
display anything.
I'll need to dynamically change the dsFeatures.setPath when I
click on the menus some how.
dsFeatures.setXPath("products/product[grade =
'"+???+"']/features/feature");
Below is my code.
XML used to create the menus and the display the content.
<products>
<product>
<name>Math</name>
<category>Life Math</category>
<grade type="grade">Grade 6 - 8</grade>
<subject>Life Math Grade 6 - 8</subject>
<image>images/math_icon.png</image>
</product>
<product>
<name>Math</name>
<category>Division</category>
<grade type="grade">Grade 5</grade>
<subject>Life Math Grade 5</subject>
<image>images/math_icon.png</image>
</product>
<product>
<name>Science</name>
<category>Life Math</category>
<grade type="grade">Grade 6 - 8</grade>
<subject>Life Science Grade 6 - 8</subject>
<image>images/science_icon.png</image>
</product>
<product>
<name>Social Studies</name>
<category>Studies</category>
<grade type="grade">Grade 5</grade>
<subject>Social Studies Life Grade 5</subject>
<image>images/social_icon.png</image>
</product>
<product>
<name>Language Arts</name>
<category>Life Arts</category>
<grade type="grade">Grade 3 - 4</grade>
<subject>Life ArtsGrade 3 - 4</subject>
<image>images/language_icon.png</image>
</product>
</products>
// Get all the products data and use distinct() to filter the
names.
var dsProducts = new
Spry.Data.XMLDataSet("included/d_products.xml",
"/products/product", { useCache: false, distinctOnLoad: true,
distinctFieldsOnLoad:['name']});
// Get the menu by grade using distinct()
var dsByGrade = new Spry.Data.XMLDataSet(null,
"/products/product/grade", { useCache: false, distinctOnLoad: true,
sortOnLoad: "grade", distinctFieldsOnLoad:['grade'] });
// Create the dsFeatures data set, pass a null for the URL
parameter so that it doesn't load
var dsFeatures = new Spry.Data.XMLDataSet(null,
"/products/product[name = '{dsProducts::name}']/features/feature",
{ useCache: false });
// Define a function that to register as an observer on
dsProducts.
function updateCategoriesAndFeatures(notificationType,
notifier, data)
// Interested in "onPostLoad" notifications.
// If it is any other notification, just bail.
if (notificationType != "onCurrentRowChanged" &&
notificationType != "onPostLoad")
return;
// Received an "onPostLoad" or "onCurrentRowChanged
notification
// from dsProducts! Ask it for its XML document. If it has
one, tell
// dsFeatures to extract its data from that document.
var doc = dsProducts.getDocument();
if (doc)
if (notificationType == "onPostLoad")
dsByGrade.setDataFromDoc(doc);
dsFeatures.setDataFromDoc(doc);
// Register the function as an observer on dsProducts.
dsProducts.addObserver(updateCategoriesAndFeatures);
Menus:
Display by names:
<ul spry:region="dsProducts" id="nameRegion">
<li class="product" spry:repeat="dsProducts"
spry:setrow="dsProducts" spry:select="selected" spry:hover="hover"
>{name}</li>
</ul>
Display by grades:
<ul spry:region="dsByGrade" id="gradeRegion">
<li class="grade " spry:repeat="dsByGrade"
spry:setrow="dsByGrade" spry:select="selected" spry:hover="hover"
>{grade}</li>
</ul>
Content.
Display the features content:
<ul spry:region="dsFeatures">
<li spry:repeat="dsFeatures">{subject} <br />
{image}</li>
</ul>
Any idea on how to go about this or pointer to an example
would be appreciated.
~Cheers

Does anybody have idea?

Similar Messages

  • How to display all important keys in the menu at runtime...?

    Dear All.
    I need a urgent help from forms guru's,my requirement is i need to display all the necessary keys on the menu option i.e keys(if you press ctrl+F1) at forms runtime.if you see only un necessary keys are displayed instead of the very basic keys like Enter Query and Execute Query. how can i display those keys. see the below unwanted keys which showing default.
    Function Key
    Cancel Esc
    Clear Field/ITem Ctrl+u
    Delete Backward Delete
    Delete Backward Backspace
    Display Error Shift+F1
    Left Left
    Return Enter
    Right Right
    Show Keys Ctrl+F1
    i have tried numurous way to do so but at last i cound't.
    i need to display something like
    Enter Query F7
    Excute Query F8
    Sace F10
    it would be great if anyone can give me the idea. i have refered many document and i have changed all the posibilities in frmusw.res file through terminal.
    Thanks in Advance

    Matthew,
    Please see this post:
    https://discussions.apple.com/message/24421822#24421822

  • How to display  servlet dynamically generated image ?

    Hi,
    How to display servlet dynamically generated image ?
    I have a servlet generating a buffered image in the doGet. I want to display the image in a jsp page with other information. I'm not able to get it properly displayed.
    **Try n# 1 **************************************************************
    This displays my image but nothing elle :
    ServletOutputStream sos = pResponse.getOutputStream();
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
    encoder.encode(img);
    **Try n# 2 ****************************************************************
    I tried also :
    In the servlet :
         request.setAttribute("renderedImage", img);
    and in the jsp page :
         BufferedImage image = (BufferedImage) request.getAttribute("renderedImage");
         <img src="<%=ImageIO.write(image,"jpeg",response.getOutputStream())%>" width="300" height="280"/>
    This last try draws big crap in the jsp page, thank you in advance.
    Nelson

    Call another servlet from the IMG tag. Have the servlet stream out the image using ImageIO (instead of writing HTML).

  • How to display properties of dimension on the input form and report in bpc

    Dear Expert,
    Please tell me how to display properties of dimension on the input form and report in bpc. I can only display dimension number.
    thanks so much
    hungth

    Hi Hungh,
    If your are using BPC 10 with EPM add in client, you can use the function:
    EPMDimensionProperty ()
    This function retrieves the properties of a specified dimension in a specified cell range.
    Thanks, Safa

  • How to assign a dynamic value to the value property of a button ?

    Hi Folks,
    I have a need, can i know how to assign a dynamic value to the value property of a button. Scenario is like follows...
    This is a struts based web application
    1. I have a file which consists of login user details (user name and his previlages) for a web application.
    2. I got those user details, into a List.
    3. When a user logged into the web app, in the home page there are few buttons. The type and number of buttons shown depends on the type of user/ user. (Buttons have different combination and the number of buttons available are not constant, they will vary from user to user).
    4. for each button, there will be a different action. I can pass the value of a button to an action class, but here button must have a dynamic value.
    Here is my test code:
    <%
    if (List != null)
    for (int i = 0; i <List.length; i++)
    %>
    <html:submit property="rduname" value= "<%=List%>" onclick="return submitRdu('<%=List[i] %>');"/>
    <%
    %>
    But my problem is how to assign a dynamic value to the value property of the button ( i know 'value= "<%=List[i]%>" ' will not work, just wanted show you guys).
    Thanks in advance,
    UV
    Edited by: UV_Dev on Oct 9, 2008 2:15 PM

    Let me try i know am not good at JSP but do we need double quotes here
    value= <%=List%>i think JSTL should help you about the dynamic thing                                                                                                                                                                                                                                                                                                                       

  • How to display multi-channel image in the 'proxy'?

    There're many examples to show how to display composite channels in the 'proxy'. But I don't find any example to show how to display multi-channel image in the 'proxy'. I found that I can use PSPixelOverlay to display alpha channel data like this:
    int nSpotChannel = gChannelCount - 4;
    PSPixelOverlay* overlay = new PSPixelOverlay[nSpotChannel];
    for(int i = 0; i < nSpotChannel; i++){
           if( i != (nSpotChannel - 1) )
                 overlay[i].next = overlay + i + 1;
           else
           overlay[i].next = NULL;
           overlay[i].data = gChannelData + (4 + i) * nPlaneBytes;
           overlay[i].rowBytes = gProxyRect.Width() * gDocDesc->depth / 8;
           overlay[i].colBytes = 1;
           overlay[i].r  = 230;
           overlay[i].g = 161;
           overlay[i].b = 174;
           overlay[i].opacity = 255;
           overlay[i].overlayAlgorithm = kStandardAlphaOverlay;
    pixels.pixelOverlays = overlay;
    Then, Seeing red part, it will trigger a new problem, that is how to get the color value of the alpha channel by plung-in itself? It seems that no channel color value info is in FilterRecord.
    If you have other solution, please tell me. Many thanks!

    This is what I've been doing - was just curious if there was a way to see a more cohesive image.
    If the individual EQ plugins are in fact the answer, is there any way to smooth how the Analyzer displays? The image I posted above, all of the tonal curves are very smooth. The analyzer tool shows a lot of peaks and valleys within the overall curve and it's hard to pinpoint each instrument's "sweet spot." Vocals for example are very hard to spot.
    - Morgan

  • How to display language key (0LANGU) in the query for BW report

    Hi,
    Can someone tell me how to display language key (0LANGU) in the query? I want to display which language (English or French) is used for material description in BW report. Thx.

    hi,
    check if the infoobject is kept as lang dependent or not  for material text, else you need to create a masterdata attribute with text and lang keys and do corresponding mapping, so then it can be displayed in your report
    regards
    laksh

  • How to create a dynamic table were the JTable columns keep varying

    How to create a dynamic table were the JTable columns keep varying based on the input to the jtable

    Oooh, I lied. DefaultTableModel has an API for adding and
    removing columns. I didn't know that. You should have read
    the API.
    As for preferring to extend AbstractTableModel rather than
    DefaultTableModel, I think it's more correct. DefaultTableModel
    is a simple implementation of Abstract for basic cases. It isn't
    intended to be extended. I figure most people extending
    DefaultTableModel are also extending JFrame, JPanel, and Thread
    instead of encapsulating the first two and implementing
    Runnable for the third.

  • How to display my country flag on the task bar in osx mavericks?

    How to display my country flag on the task bar in osx mavericks?

    System Preferences > Keyboard > Input Sources
    Checkmark the box beside "Show Input menu in menu bar".

  • I have checked the box "display date and time on the Menu Bar" and it does not work.  Using OS X Yosemite 10.10.2  Anybody have a fix?

    I have checked the box "display date and time on the Menu Bar" and it does not work.  Using OS X Yosemite 10.10.2  Anybody have a fix?

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Please take this step regardless of the results of Step 1.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

  • I am trying to get the most speed out of the browser, instructions say to type about:config in the address bar and hit enter, I did this. It now says to rt. click, from the menu select "New" then "Integer", I cannot find "New", I need better directions.

    when I typed in about:config in the address bar and hie enter, what appeared looked like a lot of files, pages of them, I didn't know where to right click from the menu select "New"

    Which prefs to you want to change?
    It is not recommended to change prefs in order to tweak some settings.<br />
    Do you have specific problems?

  • How do I add a new page dynamically base on the expendable text field?

    Hi, All,
    I've created a form with flow subform and expendable text fields. When the user fills out lengthy content, the form get cut off. Is there a way to dynamically add pages base on the content that user fills in the expendable text field?
    Thanks,

    May be you need check some things..
    1) See if the form is saved as Dynamic PDF form.
    2) The TextField should be set the "Expand to Fit" Check box checked in the Height property.
    3) The subform that contains the TextField should set to Auto Fit for Height.
    Thanks
    Srini

  • OIM Reporting: How to pass a dynamic parameter in the xml file

    Hi,
    I am generating a custom report in OIM. My stored procedure is ready and I am getting the required data when I query the database. However,while displaying it through the xml file, I need to filter the fetched data by group name. The glitch present here is that the group name is dependent on the resource selected and so the group parameter is dynamic. How can I pass this dynamic group parameter in the xml file to filter the data. Which attributes are to be used. Can anyone please help me out regarding this?
    Thanks in Advance,
    SK

    The OOTB OIM reporting mechanism does not support dependant LOVs, which is
    what you are asking for.

  • How to display a dynamic image file from url?

    Hey,I want to display a dynamic image file from url in applet.For example,a jpg file which from one video camera server,store one frame pictur for ever.My java file looks like here:
    //PlayJpg.java:
    import java.awt.*;
    import java.applet.*;
    import java.net.*;
    public class PlayJpg extends Applet implements Runnable {
    public static void main(String args[]) {
    Frame F=new Frame("My Applet/Application Window");
    F.setSize(480, 240);
    PlayJpg A = new PlayJpg();
    F.add(A);
    A.start(); // Web browser calls start() automatically
    // A.init(); - we skip calling it this time
    // because it contains only Applet specific tasks.
    F.setVisible(true);
    Thread count = null;
    String urlStr = null;
    int sleepTime = 0;
    Image image = null;
    // called only for an applet - unless called explicitely by an appliaction
    public void init() {
                   sleepTime = Integer.parseInt(getParameter("refreshTime"));
              urlStr = getParameter("jpgFile");
    // called only for an applet - unless called explicitely by an appliaction
    public void start() {
    count=(new Thread(this));
    count.start();
    // called only for applet when the browser leaves the web page
    public void stop() {
    count=null;
    public void paint(Graphics g) {
    try{
    URL location=new URL(urlStr);
    image = getToolkit().getImage(location);
    }catch (MalformedURLException mue) {
                   showStatus (mue.toString());
              }catch(Exception e){
              System.out.println("Sorry. System Caught Exception in paint().");
              System.out.println("e.getMessage():" + e.getMessage());
              System.out.println("e.toString():" + e.toString());
              System.out.println("e.printStackTrace():" );
              e.printStackTrace();
    if (image!=null) g.drawImage(image,1,1,320,240,this);
    // called each time the display needs to be repainted
    public void run() {
    while (count==Thread.currentThread()) {
    try {
    Thread.currentThread().sleep(sleepTime*1000);
    } catch(Exception e) {}
    repaint(); // forces update of the screen
    // end of PlayJpg.java
    My Html file looks like here:
    <html>
    <applet code="PlayJpg.class" width=320 height=240>
    <param name=jpgFile value="http://Localhost/playjpg/snapshot0.jpg">
    <param name=refreshTime value="1">
    </applet>
    </html>
    I only get the first frame picture for ever by my html.But the jpg file is dynamic.
    Why?
    Can you help me?
    Thanks.
    Joe

    Hi,
    Add this line inside your run() method, right before your call to repaint():
    if (image != null) {image.flush();}Hope this helps,
    Kurt.

  • How to have a JComboBox display an item different from the one selected

    Hello,
    I have a JTable (single column). I have set this column cell editor to be a JComboBox...
    JComboBox stdComboBox = new JComboBox();
    TableColumn column_zero = stdTablewCombo.getColumnModel().getColumn(0);
            column_zero.setCellEditor( new DefaultCellEditor(stdComboBox) );I have added a lovString array say {"A", "B", "C") to this stdComboBox. However, when the user selects a value from this list, I need to display a value from another lovString array say {"1", "2", "3"}. So if the user selects A then 1 needs to be displayed.
    I have a TableModelListener on this table that is getting me the correct selected index for any of the JComboBoxes on any of the rows. But I am little lost on how to display the value from the 2nd list.
    Thanks.

    Yes...but do I do that in the TableModelListener ?
    This is what I've tried in the TableModelListener:
    public void tableChanged(TableModelEvent e)
             System.out.println(e.getSource());
               if(e.getType() == TableModelEvent.UPDATE)
                    TableModel model = stdTablewCombo.getModel();
                    int row = e.getFirstRow();
                    this.cellValue = ((String)model.getValueAt(row, 0));
                    if (cellValue != null)
                         this.selectedIndex = this.stdComboBox.getSelectedIndex();
                          System.out.println("Selected Index:" + this.selectedIndex);
                          if (this.selectedIndex >= 0)
                             String valueToSet = this.lovStringB[this.selectedIndex];
                             model.setValueAt(valueToSet, row, 0);
                          else
                               System.out.println("Value in cell is not from List");
                          }It returns the selectedIndex value allright.
    It sets the value of valueToSet string allright.
    it also does the model.setValueAt allright....but this triggers a tableChanged event and it goes back up - this is also fine. However, when it now comes back to the this.selectedIndex = , this again returns the index of the original selection and not a -1 (for values not in the ComboBox list). This makes it go into an infinite loop and gives me a StackOverflowError.
    Edited by: 799076 on Oct 10, 2010 9:41 AM
    Edited by: 799076 on Oct 10, 2010 9:49 AM

Maybe you are looking for