Announcement

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

    Question: Sorting SelectItem values generated by Datasource - IncludeFrom

    SmartClient Version: v9.1p_2014-07-01/PowerEdition Deployment (built 2014-07-01)
    Firefox 23+

    Is it possible to somehow configure an 'order by' for the list of values generated via the 'includeFrom' attribute in a datasource?

    I have 2 datasources.
    The primary datasource is fed to a ListGrid.
    The second datasource is providing the list of values for one of the columns in the primary datasource.

    ListGrid.setShowFilterEditor == TRUE

    I would like the automagically generated SelectItem values in the FilterEdtior to be sorted.

    I can achieve this if I add an <orderClause> to the secondary datasource's default <fetch> binding. But this then effects the filtering of the secondary datasource when it is used independently.

    Primary Datasource
    Code:
    <DataSource ID="myDataSource" 
                dataFormat="iscServer" 
                serverType="sql" 
                dbName="MY_SVC" 
                tableName="MY_TABLE"
                autoCacheAllData="true">
        <fields>        
          <field name="OD_ID" sequenceName="OD_ID_SEQ" type="sequence" primaryKey="true" canEdit="false"/>
          <field name="O_ID" type="integer" required="true" foreignKey="reportObjectsTable.O_ID" displayField="objectName" title="Object Name"/>
          <field name="OBJECT_ID" nativeName="O_ID" canEdit="false" includeFrom="reportObjectsTable.O_ID" />
          <field name="TYPE" type="text" required="true" length="20"/>
          <field name="SUB_TYPE" type="text" required="true" length="50"/>
          <field name="CONN_ID" type="integer" required="true" foreignKey="connectionsTable.CONN_ID" displayField="connectionName" title="Connection Name"/>        
          
          <field includeFrom="reportObjectsTable.objectName" hidden="true"/> 
          <field includeFrom="connectionsTable.connectionName" hidden="true"/> 
        </fields>
    </DataSource>
    Secondary Datasource
    Code:
    <?xml version="1.0"?>
    <DataSource ID="secondaryDataSource" 
                dataSourceVersion="1" 
                dbName="MY_SVC" 
                serverType="sql" 
                tableName="MY_TABLE2" 
                autoCacheAllData="true">
      <fields>
        <field name="O_ID" primaryKey="true" sequenceName="O_ID_SEQ" type="sequence" canEdit="false"/>
        <field name="objectName" nativeName="NAME" length="80" required="true" type="text"/>
      </fields>
      <dropExtraFields>true</dropExtraFields>
      <operationBindings>
        <!-- 
        <operationBinding operationType="fetch">
          <orderClause>objectName</orderClause>
        </operationBinding>
         -->
      </operationBindings>
    </DataSource>
    I will create a test case if the above is not sufficiently clear.

    Cheers

    #2
    Use listGridField.filterEditorProperties or filterEditorType to customize the generated control in the FilterEditor, including setting initial sort or using a different operationBinding (via optionOperationId).

    Comment

    Working...
    X