Skip navigation
Currently Being Moderated

Spry & onclick conflict

Feb 11, 2010 6:11 AM

Spry newbie here, so maybe I'm doing something wrong but, I created a small XML data file and then an HTML file to display the XML data in a sortable table. So far, so good -- If I click on any column header, the table is sorted by the data in that column. Now, I want the column header background color to change, as a visual indication of the column that was sorted. I added an onclick=... to call a function to change the background color. The line looks like this:

 

<th id="col1" spry:sort="last" onclick="hilite('col1')">Last Name</th>

 

When I click on the column header, nothing happens. But if I change 'onclick' to 'onmouseover' instead, then the function works, as expected. Or, if I leave it as is and temporarily delete the 'spry:sort' then the header changes color (but of course the sort no longer works). About all I can guess is that there's some sort of conflict between having 'spry:sort' and 'onclick' in the same line.

 

So, the big question -- Is there some way to enable a workable JavaScript function call in a line containing 'spry:sort' ??

 

Thanks for any help on this,

 

John

 
Replies
  • Currently Being Moderated
    Feb 11, 2010 6:15 AM   in reply to John Woram

    You may try to sort the dataset by yourself, avoiding spry:sort at all.

    Something like:

     

     

     

     

     

     

     

    Massimo

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 11, 2010 6:28 AM   in reply to Massimo Foti

    Well actually,

     

    The spry:sort refreshes the whole region, so when you click the button and mighlight a element inside the region it could be erased by the region refresh.

    Thats why Spry is using observers events. http://labs.adobe.com/technologies/spry/articles/data_set_overview/ind ex.html take a look at that. And especially the DataSet observers.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 11, 2010 6:31 AM   in reply to Arnout Kazemier

    Yes, Arnout is right, please disgard my answer. I've read your post too

    quickly and my answer was wrong.

     

    Massimo

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points