Spry Sorting

Hello!
Is use this code in my spry xml dataset and spry table:
<div class="MainContent">
<div spry:region="dsCatalog">
<table border="0" cellspacing="0" cellpadding="3">
<tr bgcolor="#CCCC99">
<th spry:sort="@id"><div align="left"
class="style2"><a
href="#">Nr</a></div></th>
<th spry:sort="date"><div align="left"
class="style2"><a
href="#">Dato</a></div></th>
<th spry:sort="Fullname"><div align="left"
class="style2"><a
href="#">Merkenavn</a></div></th>
<th spry:sort="district"><div align="left"
class="style2"><a
href="#">Distrikt</a></div></th>
<th spry:sort="score"><div align="right"
class="style2"><a
href="#">Karakter</a></div></th>
</tr>
<tr spry:repeat="dsCatalog" spry:setrow="dsCatalog"
spry:odd="odd" spry:even="even" spry:hover="hover"
spry:select="selected">
<td><div
align="left">{@id}</div></td>
<td><div
align="left">{date}</div></td>
<td><div
align="left">{Fullname}</div></td>
<td><div
align="left">{district}</div></td>
<td><div
align="right">{score}</div></td>
</tr>
</table>
</div>
</div>
The problem I have is that the highest amount of digits I use
in the score field is 10,0 (3 digits) and all other values is 2
digits (9,5 and 8,0) and the three digit value will not sort in the
right order. I use sorting in all columns as you can see. The value
of 10,0 will always stays in bottom (ascending) or top
(descending). Do I have to use XSL to give a solution to this (and
if so, how to implement it?). Or maybe there is another solution to
this?
Thanks in advance!
E.B
Text

Hi E.B.,
The trouble stems from using commas instead of decimal
points.
First, by default, Spry assumes the column is text and sorts
it as such.
If you set the column to a number:
datasetname.setColumnType("columnname","number");
Spry will return [NaN} (not a number) because it can't deal
with the commas.
If you use decimals points, it will work correctly.
If you can't use decimals, the solution will have to be XSL
or otherwise.
Hope this helps.
Donald Booth
Adobe Spry Team

Similar Messages

  • Currency Format in Spry Sort Table

    Any ideas on how to format all numbers in a spry sort table
    into US currency? Currently on my site, Spry is not displaying the
    ".00" that is included in my XML file.
    My
    Spry Sort Table Example

    Hi,
    yes, I`ve had the same behavior. As a workaround, you have to change the format of the cells.
    Go into the properties of the cells:
    -> Right mouse click
    -> format cells
    -> category
    -> number
    -> change something, e.g. the number of decimal places to show
    Then you will have to map the component again to the same cells under "Display Data".
    And now, the currency information will be shown correctly.
    Regards
    Victor

  • Spry Sort Not Working

    Spry Detail Repeat Region on my page and I have an XML
    database. In the database are webinars, complete with a "Date" tag.
    While the data does sort, it doesn't seem to recognize them
    as dates. For instance, the date 01/01/2007 would come before
    01/02/2008, while it should be sorting it with the most recent
    first.
    As a workaround, I've input the dates in the XML table as
    they should be ordered, but it's not optimal.
    The dates are entered in as:
    MM/DD/YYYY
    I've copied the relevant parts of the code below and would
    appreciate some help!
    Thank you,
    Dan
    <script src="../../../SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="../../../SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <script src="../../../SpryAssets/SpryURLUtils.js"
    type="text/javascript"></script>
    <script src="../../../SpryAssets/SpryPagedView.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    //Define the Data Set
    var ds1 = new Spry.Data.XMLDataSet("webinars.xml",
    "news/article/Date",{sortOnLoad:"Date",sortOrderOnLoad:"ascending",distinctOnLoad:true});
    ds1.setColumnType("Date", "date");
    var pageOffset = 0;
    var pageSize = 29;
    var pageStop = pageOffset + pageSize;
    </script>
    <script type="text/javascript">
    //Get the URL parameter for the row number
    var ds1 = new Spry.Data.XMLDataSet("webinars.xml",
    "news/article", { filterFunc: MyPagingFunc });
    // webinarimage is not a valid date so you should not be
    // setting the column type for it.
    // ds1.setColumnType("webinarimage", "date");
    var params = Spry.Utils.getLocationParamsAsObject();
    if (params.row)
    ds1.addObserver({ onPostLoad: function(ds, type) {
    ds1.setCurrentRow(params.row); }
    function MyPagingFunc(ds, row, rowNumber)
    if (rowNumber < pageOffset || rowNumber >= pageStop)
    return null;
    return row;
    function UpdatePage(offset)
    var numRows = ds1.getUnfilteredData().length;
    if (offset > (numRows - pageSize))
    offset = numRows - pageSize;
    if (offset < 0)
    offset = 0;
    pageOffset = offset;
    pageStop = offset + pageSize;
    // Re-apply our non-destructive filter on dsStates1:
    ds1.filter(MyPagingFunc);
    // Tell our 2nd region to update because we've adjusted
    // some of the variables it uses in its spry:if expressions.
    Spry.Data.updateRegion("list2");
    // Change the XPath for the 3rd data set so that the 3rd
    // region updates. Remember, position() starts at one and
    not
    // zero, so we have to add one to our pageOffset and
    pageStop.
    dsStates3.setXPath("/states/state[position() >=" +
    (pageOffset+1) + " and position() < " + (pageStop+1) + "]");
    </script>
    <div id="Specials_Detail_DIV" spry:detailregion="ds1"
    class="SpryHiddenRegion">
    <table id="Specials_Detail_Table">
    <tr>
    <td width="200" valign="top"><a
    href="Webinars_detail.asp?row={ds_RowID}">{webinarimage}</a></td>
    <td width="238" valign="top" class="standardtext">
    <p><span
    class="subheading">{Title}</span><br>
    <br>
    {Speaker}<br></p>
    <a
    href="Webinars_detail.asp?row={ds_RowID}">{access}</a>
    <br>
    </td>
    </tr>
    </table>
    </div>
    <div id="Specials_DIV" width="500" spry:region="ds1"
    class="SpryHiddenRegion" style="overflow:auto; height:300px;
    width:500px" >
    <table id="Specials_Table">
    <tr>
    <th width="92" height="19" class="standardtext"
    scope="col" spry:sort="Title" ><a href="javascript:
    void(0)">Title</a></th>
    <th scope="col" spry:sort="topic" width="112"
    class="standardtext" ><a href="javascript:
    void(0)">Topic</a></th>
    <th scope="col" spry:sort="Date" width="92"
    class="standardtext" ><a href="javascript: void(0)">Air
    Date</a></th>
    </tr>
    <!--User clicks to reset the current row in the data
    set-->
    <tr spry:repeat="ds1" spry:setrow="ds1" spry:odd="eg-bar"
    spry:even="eg-bar2">
    <td valign="top" class="standardtext" ><a
    href="javascript: void(0)">{Title}</a></td>
    <td valign="top" class="standardtext"
    >{topic}</td>
    <td valign="top" class="standardtext"
    >{Date}</td>
    </tr>
    </table>
    </div>
    [code]
    <article id="23ASD38675">
    <Title><![CDATA[Title]]></Title>
    <Speaker><![CDATA[Speakers: ]]></Speaker>
    <Genesys><![CDATA[<a href="../link"><img
    src="../../../images/icn_webinar_39.gif" width="39" height="40"
    border="0"><br>View Replay</a>]]></Genesys>
    <Date>02/27/2008</Date>
    <MDate>February 27, 2008</MDate>
    <Series>Family Continuity and Governance
    Series</Series>
    <webinarimage><![CDATA[<img
    src="../../../private/members/resource_center/images/022708-preview-imageB.gif"
    width="200" height="150" border="0">]]></webinarimage>
    </article>
    [/code]

    Date sorting with the format you use works just fine. I just
    tested it out. So I took a closer look at your code, and I see
    this:
    var ds1 = new Spry.Data.XMLDataSet("webinars.xml",
    "news/article/Date",{sortOnLoad:"Date",sortOrderOnLoad:"ascending",distinctOnLoad:true});
    ds1.setColumnType("Date", "date");
    var ds1 = new Spry.Data.XMLDataSet("webinars.xml",
    "news/article", { filterFunc: MyPagingFunc });
    You are basically creating a ds1, setting the column type,
    and then blowing away the original ds1 with a new one you create.
    Which means your column type for Date is reset back to "string".
    Delete ds1 creation code you don't want, and then place the
    setColumnType() call after it.
    It will then work as it should.
    --== Kin ==--

  • Styling spry:sort

    Is it possible to apply some css styling to a <th> with
    a spry:sort to give some indication of which column in a table is
    currently the one that the table is being sorted by?

    Phil:
    Thanks so much for your reply. Yes, the fact of my using Spry 1.5 was definitely the source of part of my trouble. I got the updater and now the error message has disappeared.
    My remaining problem is correctly fulfilling the implementation so that I'm triggering the addition of the ".ascending" and ".descending" classes upon user clicking the column headings. I see clearly from your example that they are being assigned dynamically and I think I have faithfully implemented the styles. But in Firebug, upon click of a column heading, while I am getting the correct Spry sorting behavior, I am unable to see the assignment of the .ascending and .descending classes.
    If I had a better grasp of the JavaScript involved I could probably troublshoot it, but in this instance, I'm just trying to implement "cookbook" style, so I'm unable even to see the dumb mistakes I may have made. My implementation seems to differ from yours only in that class and dataset names are different, data is (of course) different and I'm using an html table as a dataset whereas you are using an XML file as yours. Spry 1.6.1 is now in place.
    This is my markup (the relevant bits):
    <head>
    <script src="../SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryHTMLDataSet.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var ds2 = new Spry.Data.HTMLDataSet(null, "awards_cd", {sortOnLoad: "The_Award", sortOrderOnLoad: "ascending"});
    ds2.setColumnType("C-Deadline", "date");
    //-->
    </script>
    <script type="text/javascript">
    <!--
    function mysort(rgn,phil)
            var so = phil("{ds_SortOrder}");
            var sc = phil("{ds_SortColumn}");
            if (so.length == 0) {so="ascending"; sc="The_Award"}
            Spry.Utils.addClassName(sc,so);
            return '';
    //-->
    </script>
    </head>
    <body>
              <div spry:region="ds2">
                        <table class="spry">
                            <tr>
                                <th class="sortable" spry:sort="The_Award">The Award</th>
                                <th class="sortable" spry:sort="C-Deadline">C-Deadline</th>
                                <th class="sortable" spry:sort="Country">Country</th>
                                <th class="sortable" spry:sort="Disciplines">Disciplines</th>
                                <th>Purpose</th>
                                <th>Eligibility</th>
                            </tr>
                            <tr spry:repeat="ds2" spry:odd="odd" spry:even="even" spry:hover="hover" spry:select="hover">
                                <td>{The_Award}</td>
                                <td>{C-Deadline}</td>
                                <td>{Country}</td>
                                <td>{Disciplines}</td>
                                <td>{Purpose}</td>
                                <td>{Eligibility}</td>
                            </tr>
                        </table>
                    </div>
                    <div spry:region="ds2">{function::mysort}</div>
                    <table id="awards_cd">
                        <tr>
                            <th>The Award</th>
                            <th>C-Deadline</th>
                            <th>Country</th>
                            <th>Disciplines</th>
                            <th>Purpose</th>
                            <th>Eligibility</th>
                        </tr>
                        <tr>
                            <td><a href="marshall.html">Marshall Scholarship</a></td>
                            <td>9/1/2009</td>
                            <td>UK</td>
                            <td>All Fields</td>
                            <td>2-3 years at any British University leading to a degree</td>
                            <td>US citizen, BA by start of grant period, 3.7 undergraduate gpa</td>
                        </tr>
                        <tr>
                            <td><a href="mitchell.html">Mitchell Scholarship</a></td>
                            <td>9/1/2009</td>
                            <td>Ireland</td>
                            <td>All Fields</td>
                            <td>1 year at an Irish University leading to a degree</td>
                            <td>US citizen, BA by start of grant period, 18 &gt; 30 yrs</td>
                        </tr>
                        <tr>
                            <td><a href="rhodes.html">Rhodes Scholarship</a></td>
                            <td>9/1/2009</td>
                            <td>UK</td>
                            <td>All Fields</td>
                            <td>2-3 years at Oxford leading to a degree</td>
                            <td>US citizen, BA by start of grant period, 18 &lt; 24 yrs at time of application</td>
                        </tr>
                        <tr>
                            <td><a href="fulbright.html">Fulbright Scholarship </a></td>
                            <td>9/24/2009</td>
                            <td>Worldwide</td>
                            <td>All Fields</td>
                            <td>One academic year of study/research</td>
                            <td>US citizen, BA by start of grant period, no PhD at time of application</td>
                        </tr>
                        <tr>
                            <td><a href="ful_hays.html">Fulbright-Hays </a><a href="ful_hays.html">Doctoral Dissertation Award</a></td>
                            <td>10/15/2009</td>
                            <td>Worldwide</td>
                            <td>Non-Western Area Studies</td>
                            <td>1 year of dissertation research</span></td>
                            <td>US citizen, PhD candidate</td>
                        </tr>
                        <tr>
                            <td><a href="daad_grad.html">DAAD Graduate Award</a></td>
                            <td>11/1/2009</td>
                            <td>Germany</td>
                            <td>All Fields</td>
                            <td>1 year of study/research</td>
                            <td>US citizen, graduating senior or graduate student</td>
                        </tr>
                        <tr>
                            <td><a href="churchill.html">Churchill Scholarship</a></td>
                            <td>11/12/2009</td>
                            <td>UK</td>
                            <td>Math, Science, Engineering</td>
                            <td>1 year of graduate study at Cambridge</td>
                            <td>US citizen, BA by start of grant period</td>
                        </tr>
                        <tr>
                            <td><a href="luce.html">Luce Scholars Program</a></td>
                            <td>11/20/2009</td>
                            <td>Asia</td>
                            <td>All Fields</td>
                            <td>1 year internship</td>
                            <td>US citizen, BA by start of grant period, &lt; 30 years, no prior experience in Asia</td>
                        </tr>
                        <tr>
                            <td><a href="whitaker_fellows.html">Whitaker Program for Biomedical Engineers</a></td>
                            <td>2/1/2009</td>
                            <td>UK</td>
                            <td>Biomedical Sciences</td>
                            <td>1 year of graduate study/ research</td>
                            <td>US citizen, BA by start of grant period</td>
                        </tr>
                        <tr>
                            <td><a href="berlin.html">Free University of Berlin Graduate Exchange</a></td>
                            <td>4/15/2009</td>
                            <td>Germany</td>
                            <td>All Fields</td>
                            <td>1 year of dissertation research</td>
                            <td>PhD candidate</td>
                        </tr>
                    </table>
    </body>
    RELANT CSS:
    .even { background-color: #ede8dd; }
    .odd { background-color: #faf6eb; }
    .hover { background-color: #bcd4ec; }
    table.spry { margin: 1em 0; }
    table.spry th {
        background-color: #c2b7a1;
        text-align: left;
        padding: .5em;
    table.spry td { padding: .5em; }
    .descending { background: url(../SpryAssets/SpryMenuBarDownHover.gif) 95% 50% no-repeat; }
    .ascending { background: url(../SpryAssets/SpryMenuBarUpHover.gif) 95% 50% no-repeat; }
    table.spry th.sortable:hover { cursor: pointer; }
    TEST PAGE: http://icenter.stanford.edu/orc/grad_comparisonMGH2.html
    I have the correct graphics now.
    If you have time and can spot where I've gone awry, many thanks. And thanks again for your solution and the time you spent originally looking at my page. All in all, your functionality seems like something Adobe should have put into the widget in the first place as it is virtually universal functionality in any other sortable table solutions that I've come across.
    Best Regards,
    Mike

  • Spry:sort

    Hi thank you for reading,
    I have tried everything to make this table sort, but the only
    thing that works is by calling a sort method as you see me doing in
    the last step here.
    <div spry:region="dsItems1" spry:sort="@name">
    <table width="100%" height="100%" spry:sort="@name">
    <trspry:sort="@name" ><td spry:sort="@name">
    <h3 >Programs</h3></td></tr>
    <tr spry:repeat="dsItems1" spry:setrow="dsItems1"
    spry:sort="@name" >
    <td spry:sort="@name" style="padding-left:15px;
    "><a class="links" href="#">{@name}</a></td>
    </tr>
    </table>
    </div>
    <p>
    <input type="button" value="Sort A-Z" onclick="DoSort();"
    />
    </p>
    thanks in advance for any hints!
    ./b

    I believe your problem has to do with the fact that you have
    a spry:sort on a <td> *AND* you have a spry:sort on its
    parent <tr> which means that whenever you click on the
    <td>, the data set will be sorted by @name twice, giving the
    appearance that nothing happens?
    Make sure that you only put the sort attribute on the
    <td> or <th> elements.
    --== Kin ==--

  • Spry:sort with thead

    Hi All:
    I have been trying to get spry:sort to work in a complex
    table, but no matter what I try, the columns will not sort. As all
    examples appear to show simple tables, I suspect this is the
    problem. Has anyone got the sort function working on a complex
    table? Sample code below.
    Thanks for your advise.
    Skip Keats
    =================
    Code sample:
    <table cellspacing="1" summary="SDLC alphabetical listing
    for A">
    <caption>Alpha Listing: A</caption>
    <col id="TemplateDocNameA" />
    <col id="TemplateDocOwnerA" class="sdlcDocOwner" />
    <col id="TemplateDocPhaseA" />
    <col id="TemplateDocDescA" />
    <thead>
    <tr>
    <th id="DocNameA"
    spry:sort="SDLC_Template_Document_Name">Template Document
    Name</th>
    <th id="DocOwnerA" class="alignCenter">Document
    Owner</th>
    <th id="DocPhaseA">Phase</th>
    <th id="DocDescA">Description</th>
    <th id="DocLastModA" class="alignCenter"
    spry:sort="SDLC_LastModified">Date Last Modified</th>
    </tr>
    </thead>
    <tfoot>
    <tr>
    <td colspan="5"><!-- #BeginLibraryItem
    "/Library/SDLCTableFooterAlpha.lbi" -->Footer message.<!--
    #EndLibraryItem --></td>
    </tr>
    </tfoot>
    <tbody>
    <tr spry:repeat="dsSDLC"
    spry:test="'{SDLC_Template_Document_Name}'.charAt(0) == 'A'">
    <th id="RA{ds_RowID}" headers="DocNameA"><a
    href="{SDLC_Document_URL}" title="{SDLC_Template_Document_Name}:
    {SDLC_Description}">{SDLC_Template_Document_Name}</a></th>
    <td headers="RA{ds_RowID} DocNameA
    DocOwnerA">{SDLC_Document_Owner}</td>
    <td headers="RA{ds_RowID} DocNameA
    DocPhaseA">{SDLC_Phase}</td>
    <td headers="RA{ds_RowID} DocNameA
    DocDescA">{SDLC_Description}</td>
    <td headers="RA{ds_RowID} DocNameA
    DocLastModA">{SDLC_LastModified}</td>
    </tr>
    </tbody>
    </table>

    Unfortunately an public url is not possible as this is for an
    intranet site. However, I finally got it to work. For some reason,
    a delay occurs within Firefox and IE when you click to sort.

  • Spry:sort how to sort nested ds

    I use XMLDataSet to get Values from XML.
    First thing, i used nested XMLDataSets, to get nested datas.
    It works, but i have Problem with sort.
    When i use spry:sort and than the nested Set it adjust only the nested values like here:
    http://labs.adobe.com/technologies/spry/samples/data_region/NestedDataSample.html
    My project is a car database. So i have cars...and in the xml file are the colors and kilometers in nested roots. So i ca get them only with the nested procedure. My Target is, that when the user sort by nested value, the whole table is  sort by the nested sort.
    Like....
    If i have my table with all the cars....than i will sort the hwole table over modell....price..and and...but also over color.
    How can i make this? because now i can only change the basic datastring or the nested datastring them self... so i never can sort the whole table by color...
    Thanks for help!
    TELLO

    Any help for me?
    Here the code....so i guess it helps more to understand what i mean...:
    var ds_autosuche = new Spry.Data.XMLDataSet("............xml", "results/result[brand != 0]");
    ds_autosuche.setColumnType("price", "number");
    var ds_autosuche_modell = new Spry.Data.NestedXMLDataSet(ds_autosuche, "modell/name");
    var ds_autosuche_ez = new Spry.Data.NestedXMLDataSet(ds_autosuche, "infos/info[@type = 'ez']" );
    var ds_autosuche_fuel = new Spry.Data.NestedXMLDataSet(ds_autosuche, "infos/info[@type = 'fuel']" );
    var ds_autosuche_farbe = new Spry.Data.NestedXMLDataSet(ds_autosuche, "color/name");
    var ds_autosuche_km = new Spry.Data.NestedXMLDataSet(ds_autosuche, "infos/info[@type = 'km']" );
    i output than a table, where on every column is one value for one car. So than i can sort by brand, price....
    but not the whole table by name, km, ez, fuel... because they all nested datasources... how can i sort the whole table over nested typs....????
    TELLO

  • SPRY - sorting UK dates

    I have created a SPRY sortable table in Dreamweaver CS4.  Two  columns are formatted as UK dates dd/mm/yyyy. They are identified as  dates in the SPRY table.
    When sorting these date columns SPRY is  reading them as US date format which means the sorting is, while not  quite random, pretty meaningless.  I have checked this by reformatting  and displaying the date as US date format mm/dd/yyyy and then SPRY sorts  them as expected. 
    Would appreciate some help with how I retain  the UK date appearance and achieve a sort on that basis.  Is there a  localisation file somewhere in the SPRY framework that allows date  formats to be identified?
    If not, can anyone advise how to resolve this?
    Thanks in advance for any help.

    The root of the issue is that using JavaScript to a string into a date easily lead to inconsistent, unexpected results.
    The way I solved this in the past is to have two columns inside my Spry datasets. One stores the date in yyyy-mm-dd format (ISO 8901, the format typically used by databases), another one stores a nicely formatted date (whatever format the language dictated).
    Then I always display the nicely formatted column, but I sort it only the yyyy-mm-dd one.
    As a bonus, yyyy-mm-dd sorts okay just as a string, so I have no need to assign a different datatype to it.

  • Problem with Spry Sort

    I followed a tutorial through Adobe's site and I also read
    the help section regarding Spry tables and sorting data. It says to
    insert a Spry region and then a Spry table. I can then choose the
    specific XML item to insert and allow it to be sortable - it is
    placed in the <th> tag. It says I should be able to click on
    the table header to sort the column but it doesn't work. The
    example on the site uses an onclick action for the table header but
    the tutorials online say nothing about it. Has anyone had
    experience with this?

    Not meaning to put you off, but as spry is pretty new to all
    of us, you may
    be better asking your questions at this forum:
    http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=602
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Customisation Service Available ~
    http://www.csstemplates.com.au
    "lonewolfdj" <[email protected]> wrote in
    message
    news:f32r7k$654$[email protected]..
    >I followed a tutorial through Adobe's site and I also
    read the help section
    > regarding Spry tables and sorting data. It says to
    insert a Spry region
    > and
    > then a Spry table. I can then choose the specific XML
    item to insert and
    > allow
    > it to be sortable - it is placed in the <th> tag.
    It says I should be
    > able to
    > click on the table header to sort the column but it
    doesn't work. The
    > example
    > on the site uses an onclick action for the table header
    but the tutorials
    > online say nothing about it. Has anyone had experience
    with this?
    >

  • Date Format for Spry data set sort

    Hi
    Just feeling my way through the use of Spry Datasets for the
    first time and have a couple of issues hopefully someone with more
    knowledge of it than me know the answer to.
    I had an issue with my Spry Dataset initially that it would
    not work in ie7 but was OK in FF3.
    After some mucking round I realised the error I was getting -
    albeit obscure in IE was telling me it was a date format issue in
    my data set.
    The db data I am playing with here is fairly simple: I have a
    couple of text fields, an integer field that contains the
    unixtimestamp of the entry (its a simple diary application) and a
    formal date field that holds the same date in mysql's date format.
    When I display the date in the dataset I do so in the format
    "23rd May 2009" (as an example)- I code this using phps date
    function in my xml query.
    I had set this field to date format in the Spry dataset
    conditions but IE seems to barf on this- I can change it to
    textstring but then my sort is done on Alpha/Numeric sort of the
    first character in the date field which is rubbish.
    I only display the date in this format and one of the other
    text fields in my dataset- the unixdate is for programmatic
    purposes not general display so I cannot sort on this field if its
    invisible. How can I acheive a date based sort with this set up- or
    what date formats does Spry code prefer for date sorts? (My client
    wants the date to show as I have explained). Many thanks. I have a
    second query which I will post separately!
    Kenny

    "Tanushiheadbash" <[email protected]> wrote
    in message
    news:gqa70o$iat$[email protected]..
    > I think I follow what you are saying and in fact I think
    its what I
    > already
    > have. I have set the sort order to use the unixtime when
    the page
    > initially
    > loads and thats OK.
    I am sorry, but you aren't following my explanation. English
    isn't my mother
    tongue, and I am not able to explain it any better.
    > However what I need to be able to do is to have the
    AJAX/Javascript sort
    > (done in this case with Spry- ) to sort on the date when
    the column header
    > is
    > clicked. The problem I have is the date format in this
    visible column is
    > in
    > DDth Month YYYY format and Spry does not recocnise this
    as a date format-
    > it
    > wants it as a string ( or ie gives an error). Maybe its
    not possible what
    > I am
    > trying to do- just thought there might be a clever way
    to implement this.
    You can take a look at this page:
    http://visual.unipv.it/tmt_calendar/admin/reports/events.cfm
    Even if all the dates here are incidentally using the
    yyyy-mm-dd format, the
    dataset display the date from the "start_date_formatted"
    field:
    <td><a href="javascript:"
    onclick="showUpdate('{event_id}')">{start_date_formatted}</a></td>
    But uses another field to sort the table:
    <th scope="col" spry:sort="start_date">Start
    date</th>
    You can have the same date, using two different formats,
    inside two,
    separated dataset fields. One is used for display, the other
    one is used for
    sort.
    You may try to read again my previous explanations, look at
    the code in the
    page above and see if you get the idea.
    Massimo Foti, web-programmer for hire
    Tools for ColdFusion, JavaScript and Dreamweaver:
    http://www.massimocorner.com

  • Sorting Spry with database, how?

    how I use spry Sorting with database?

    It would help if you supplied a link to your site. Now I have to guess what it is that you want so here goes.
    Have a look here
    http://labs.adobe.com/technologies/spry/samples/data_region/DataReferences.html
    http://labs.adobe.com/technologies/spry/samples/data_region/SortSample.html
    http://labs.adobe.com/technologies/spry/samples/data_region/XMLStringSample.html
    If the above is not what you are looking for, please supply more info.
    Gramps

  • Spry for sorting tables tutorial

    I have a static table with 5 columns 10 rows and would like the user to be able to click anyone of the columns to get accending order or deccending order, to see how they rank as per column headings. I have looked at many javascript scripts, but did not work well or not what I wanted, so I thought why not spry. I looked at the spry samples on adobe site but there was no tutorials to go along with the sort table sample. If any one has a link or scripts for doing this I would be much appricated, Thx

    Hi,
    You are only seeing 15 rows as your table is not correct after entry 15. From row 16 onwards you need <td></td> for each column even if you have no entries to ensure the Spry HTML dataset picks up all the rows.
    Try the following on your site in same directory as your PHP page to see how it works on a simple page.  Change references to folders for SpryData and SpryHTMLDataSet as appropriate
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Sortable Table</title>
    <script src="SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryHTMLDataSet.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.HTMLDataSet("teamstats.php", "myTable");
    //-->
    </script>
    </head>
    <body>
    <div spry:region="ds1">
      <table>
        <tr>
          <th spry:sort="Team_Name">Team_Name</th>
          <th spry:sort="Points">Points</th>
          <th spry:sort="Wins">Wins</th>
          <th spry:sort="Poles">Poles</th>
          <th spry:sort="Top_5's">Top_5's</th>
          <th spry:sort="Top_10's">Top_10's</th>
        </tr>
        <tr spry:repeat="ds1">
          <td>{Team_Name}</td>
          <td>{Points}</td>
          <td>{Wins}</td>
          <td>{Poles}</td>
          <td>{ds1::Top_5's}</td>
          <td>{ds1::Top_10's}</td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    Phil

  • Problem with spry:select not selecting

    I am having trouble getting the spry:select to work on the
    following code. Everything works except for the spry:select. If I
    remove the spry:hover and the spry:sort, then the spry:select will
    work. The only way I can get the spry:select to work is if it is
    the only spry statement in the <td>. Please help.
    NON-WORKING SPRY:SELECT CODE:
    <div spry:region="pv1">
    Records {ds_PageFirstItemNumber}-{ds_PageLastItemNumber} of
    {ds_PageTotalItemCount}
    <table cellpadding="0" cellspacing="0" border="0"
    width="100%">
    <tr>
    <td class="tableheader" style="cursor:pointer;"
    spry:select="tableheaderSel" spry:hover="tableheaderSel"
    spry:sort="airport_code">Airport</td>
    <td class="tableheader" style="cursor:pointer;"
    spry:hover="tableheaderSel" spry:sort="hotel">Hotel</td>
    <td class="tableheader" style="cursor:pointer;"
    spry:hover="tableheaderSel"
    spry:sort="bookings">Bookings</td>
    <td class="tableheader" style="cursor:pointer;"
    spry:hover="tableheaderSel"
    spry:sort="previous_year_bookings">Previous Year</td>
    <td class="tableheader" style="cursor:pointer;"
    spry:hover="tableheaderSel" spry:sort="change">Change</td>
    <td class="tableheader" style="cursor:pointer;"
    spry:hover="tableheaderSel"
    spry:sort="percent_change">%</td>
    </tr>
    <tr spry:repeat="pv1" spry:odd="tablerow1">
    <td class="tablecell"
    spry:content="{airport_code}"></td>
    <td class="tablecell"
    spry:content="{hotel}"></td>
    <td class="tablecell"
    spry:content="{bookings}"></td>
    <td class="tablecell"
    spry:content="{previous_year_bookings}"></td>
    <td class="tablecell"
    spry:content="{change}"></td>
    <td class="tablecell"
    spry:content="{percent_change}"></td>
    </tr>
    </table>
    <p>
    <div style="float:right;">
    <input type="button" value="Next"
    onClick="pv1.nextPage();" />
    <input type="button" value="Last"
    onClick="pv1.lastPage();" />
    </div>
    <div style="float:left;">
    <input type="button" value="First"
    onClick="pv1.firstPage();" />
    <input type="button" value="Prev"
    onClick="pv1.previousPage();" />
    </div>
    </div>

    When you use a spry:sort, you are sorting the data set and
    the entire region is redrawn. This wipes out the spry:select. This
    happens to the select, no matter where it is.
    The way to highlight the currently selected column is a bit
    tedious. You will have to have a spry:if that checked the value of
    {ds_SortColumn}. This means repeating the <TD> for each
    condition.
    It's a sub-optimal solution but we don't have attribute level
    control.
    However, we do have some tools and enhancements coming up
    that should make this easier. But they are not ready yet, so...
    http://labs.adobe.com/technologies/spry/samples/data_region/DataSetMasterDetailSample.html
    has an example of how we use spry:if to conditionally put on
    an attribute.
    Don

  • How to open a new page from a Spry Table click, with element info?

    Hello, Spry experts!
    This is probably simple, but I've searched for hours and can't find what I need. I'm using Dreamweaver CS4 and Spry 1.6.1 to create a simple Spry Table from an XML data set using PHP as my back end.  I've used Dreamweaver's Insert->Spry->Spry Data Set to create everything, and the table is working fine.  Colors, clicks, sorts, etc., are all working correctly as expected.
    What I want is to be able to add a behavior such that when a table row is clicked, I can open a new page.  Moreover, I want to pass a parameter from the table to the new page, like http://www.mydomain.com/newpage.php?aid=12345 or whatever.
    So, for example, my table has two columns, "a_id" and "a_name", and my repeat region looks like this:
    <div spry:region="xml_assignments">
    <table width="500">
    <tr>
    <th spry:sort="a_id" class="spry_header">ID</th>
    <th spry:sort="a_name" class="spry_header">Assignment</th>
    </tr>
    <tr spry:repeat="xml_assignments" spry:setrow="xml_assignments" spry:odd="spry_odd" spry:even="spry_even" spry:hover="spry_hover" spry:select="spry_select">
    <td>{a_id}</td>
    <td>{a_name}</td>
    </tr>
    </table>
    </div>
    What I want is to be able to open an entirely new URL, passing the value of the {a_id} in the selected row as a parameter to the new URL, as in something like:  http://www.mydomain.com/newpage.php?aid={a_id}
    So my questions are: 
    1. How best to apply the action to the table?  Add an onclick to the tr tag?  Something else?
    2. How to extract the {a_id} value from the current row and pass it as a parameter to the action?
    Or maybe just take another approach entirely?
    I know that I can make the actual text in the table cells hyperlinks, and use them to link to the new page, which is fine.  The desire here is just to make it so that the user can click "anywhere" on the table row (as they can currently do with the spry:select behavior) and have the link kick off, whether they actually click on the linked text or somewhere in the row where there is no text.
    I'm sure this is obvious and simple, but I'm new to this level of Spry detail, and my brain is fried from hunting.  Any guidance will be gratefully appreciated!
    Glen Barney

    I found the answer myself, after posting this, of course!
    I changed:
    <tr spry:repeat="xml_assignments" spry:setrow="xml_assignments" spry:odd="spry_odd" spry:even="spry_even" spry:hover="spry_hover" spry:select="spry_select">
    to
    <tr spry:repeat="xml_assignments" spry:setrow="xml_assignments" spry:odd="spry_odd" spry:even="spry_even" spry:hover="spry_hover" spry:select="spry_select" onclick="window.location.href='./newpage.php?aid={a_id}';">
    Basically just added the onclick parameter...
    And it all just worked!

  • Error message when using Spry Data set with XML

    Hi,
    I have what i see as a big problem, might just be me being
    dumm, but here we go.
    When I try to use the feature of spry XML Data Set and insert
    spry table I get error message when trying it in IE 7.
    There are even a problem when I use fireworks automated slide
    show function, where you can choose to use the Spry/XML gallery
    feature.
    The error message I get everytime (incl the auto gallery in
    fireworks) is:
    The tag: "html" doesn't have an attribute: "xmlns:spry" in
    currently active versions.[XHTML 1.0 transitional]
    The tag: "div" doesn't have an attribute: "spry:region" in
    currently active versions.[XHTML 1.0 transitional]
    The tag: "th" doesn't have an attribute: "spry:sort" in
    currently active versions.[XHTML 1.0 transitional]
    and so on.
    What´s wrong?!

    Hello barvid,
    Ok, let's take each problem step by step:
    1. The first error you see in the browser: " Exception while
    loading ..." normally appears when you try to load files that are
    not permitted by the browser security model. This means the XML
    file you try to load is located on a different server than your
    HTML which is not allowed. The browser is not permitting to load
    any files that are not in the same domain as the current page
    because of the complex security risks. You'll have to either get
    the XML file from its original location and save it in your website
    or use a proxy on your web server that should request that file
    from the external server and send it to the browser as an XML from
    the same domain as the HTML origin.
    1.2 The "Exception while loading ..." error you see is a
    generic error and my previous advise is based on my experience. In
    case this is not your scenario you'll have to open the SpryData.js
    and around line 112 you'll see the following code:
    Spry.Debug.reportError("Exception caught while loading " +
    url + ": " + e);
    Please change this line with the following line of code:
    Spry.Debug.reportError("Exception caught while loading " +
    url + ": " + (e.message?e.message:e));
    to obtain a more verbose error message that may clarify the
    reasons of your errors.
    2. The problems you describe are not browser errors but they
    are w3c validation errors. At this point the XHTML standard allows
    every application that define custom namespace attributes to also
    link a DTD to the page so the page to continue to be valid.
    Unfortunately at this point this feature is not correctly supported
    by the FF and IE so we wrote an articles about how you should
    link
    the Spry DTD to your page so the validator understand the
    custom attributes Spry use. You'll find inside the full description
    of the problems and all the technical details you'll need to know
    to solve this issue.
    Regards,
    Cristian

Maybe you are looking for

  • How can I reduce the time it takes to render my clips?

    I'm working on a MacBook Pro, 2.4 GHz Intel Core 2Duo machinewith 4 GB 667 MHz DDR2 SDRAM, usinf Final Cut Pro 6. In my current project I have one clip that's about 40 minutes long. I recorded separate audio on a Zoom H4n and the audio clip is even l

  • Forms Layouts and templates

    How do i be able to create the templates and layouts of the Oracle Forms . So that standardization can be maintained in the whole application.....?? Please help........

  • Why does my computer freeze on MAC OS X Lion?

    Since my friend insalled MAC OS X Lion on his iMac Desktop Computer we have been having a lot of freezing and sometimes running slowly! Does anyone know what is going on with this or is it the iMac problem! My friend Jacob owns the 2 iMac Desktops th

  • How to make a background image?

    I wanted to try something special. For a few pages, and ideally the inside covers of the book, I would like to print a thumbnail of a logo on a white background as a backdrop for some of the pages. I see where to make a photo into the background for

  • Auto-increase of numeric value in autocomplete

    What I'm wondering is can autocomplete use the value entered into the previous field and increase that value by one numeric digit for the new autocomplete?  For example, if the first entry is manually entered as "W1234" can you have autocomplete ente