Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Script Library

  Filter with an alphabetical list
  chubbard posted this script:
  This function writes out each letter of the alphabet, A to Z, and writes a link for each one that filters on a value starting with that letter. You can call it from within a view. Pass in the URL for the link (usually the same view) for the szViewUrl argument. For the szFilterField argument, pass in the name of a text field in your view.

webcall function outputAlphaLinks(szViewUrl, szFilterField)
    //we need to know which field we're filtering on
        throw(Error(Errors.GeneralFailure, "Filter field must be provided."));

    //if there's no url provided, just append the filter parameter.
        szViewUrl = "?";
    //if there is a url provided, determine whether it has any parameters.
        var aURLPart = szViewUrl.split("?");
        //Append the filter parameter, either to the url or to the parameter list.
            szViewUrl += "?";
            szViewUrl += "&";

    //loop through the upper-case ASCII characters
    for(var i = 65; i < 91; i++)
        //output each letter with a link filtering on that letter.
        <a href="<%=szViewURL + szFilterField + "~startswith="
            + String.fromCharCode(i)%>">

Here's an example that calls the function from within a view on a Products table:
var c = classes.import("/");
c.outputAlphaLinks("/Products/default.view?_mode=grid", "ProductName");
<ws:dataregion defaultmode="grid" actionbarposition="bottom" jumpbarposition="top">
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us