Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How do we order the list appearing in a ListGrid filter?

    I am using:
    * SmartClient Version: v8.3p_2013-04-23/PowerEdition Deployment (built 2013-04-23)
    * MS Windows Explorer 9, Version 9.0.8112.16421

    I have a ListGrid that shows Filters at the top. The column I am interested in (category) is created as follows

    Code:
        ListGridField category = new ListGridField("SCT_ID", "Category");
        category.setOptionDataSource(DataSource.get("refCodes"));
        category.setValueField("CODE");
        category.setDisplayField("DESCRIPTION");
        category.setOptionOperationId("SCI");
    The RefCodes datasource is

    Code:
    <DataSource
            ID="refCodes"
            serverType="sql"
            tableName="TG_REF_CODES"
            >
      <fields>
        <field name="CODE" type="text" length="4"/>
        <field name="DOMAIN" type="text" length="3"/>
        <field name="DESCRIPTION" type="text" length="75"/>
      </fields>
    
      <operationBindings>
        <operationBinding operationType="fetch" operationId="SCI">
          <criteria fieldName="DOMAIN" value="SCI"/>
        </operationBinding>
      </operationBindings>
    </DataSource>
    When I click on the Filter drop down control for field category (at the top of the ListGrid) all the values are there but in no particular order. I would like them to appeqar in ascending. How can that be achieved?

    Thank you

    #2
    The order will be whatever order the server returns the values.

    You can set selectItem.sortField to ask for a specific sort.

    Comment


      #3
      Thank you for the reply.

      Immediately after posting my entry to the forum I tried using the orderClause and it worked. I added
      <orderClause>DESCRIPTION</orderClause> to the operationBinding.
      In this case it is ok to order by description because the number of records returned is small.

      Thanks again.

      Comment

      Working...
      X