Announcement

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

    Sort by includeFrom field does not work

    I am using SmartGWT Power 3.0. I have two data sources; One is referencing another with includeFrom tag:

    Code:
    <DataSource
    	dbName="jdbc/main"
    	tableName="es_branch_office"
    	ID="es_branch_office"
    	serverType="sql"
    >
    	<fields>
    		<field primaryKey="true" name="id" type="sequence" hidden="true"></field>
    		<field name="cut_off_time" type="integer"></field>
    		<field name="default_email" length="255" type="text"></field>
    		<field name="ext_code" length="255" type="text"></field>
    		<field name="name" length="255" type="text"></field>
    		<field name="status_id" title="Active">
                        <valueMap>
                            <value id="1">Active</value>
                            <value id="2">Inactive</value>
                        </valueMap>
                    </field>
    	</fields>
    </DataSource>
    
    
    <DataSource 
    	schema="dbo"
    	dbName="jdbc/main"
    	tableName="es_order_batch"
    	ID="es_order_batch"
    	serverType="sql"
    >
    	<fields>
    		<field primaryKey="true" name="id" type="sequence" hidden="true"></field>
           ....
    		<field name="specific_number_for_check" length="255" type="text"></field>
    		<field name="status_id" type="integer"></field>
    		<field name="status_desc" length="255" type="text"></field>
    		<field name="branch_office_id" type="number" hidden="true" foreignKey="es_branch_office.id"></field>
                    <field name="branch_office" includeFrom="es_branch_office.ext_code"/>
    	</fields>
    </DataSource>
    I have list grid with data source es_order_batch. However, sorting works on all columns from original table, but does not work for branch_office column which is from es_branch_office table. Note that es_order_batch has several thousands of rows so sorting is done on the server side.

    I am using SQL Server database, and here is query that is generated by data source when sorting by branch_office column. When I execute it directly, results are NOT sorted by es_branch_office.ext_code column:

    Code:
    SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY x.ext_code DESC) AS rowID FROM (SELECT TOP 100 PERCENT  es_order_batch.batch_type, es_order_batch.branch_office_id, es_order_batch.client_amount_for_check, es_order_batch.client_currency_for_check, es_order_batch.client_id_for_check, es_order_batch.client_name_for_check, es_order_batch.client_type, es_order_batch.comment, es_order_batch.created_by_full_name, es_order_batch.created_time, es_order_batch.ext_code, es_order_batch.forwarded_by_full_name, es_order_batch.forwarded_time, es_order_batch.id, es_order_batch.number_of_orders, es_order_batch.priority, es_order_batch.specific_number_for_check, es_order_batch.status_desc, es_order_batch.status_id, es_branch_office.ext_code AS branch_office 
    FROM dbo.es_order_batch, es_branch_office 
    WHERE ('1'='1') AND es_branch_office.id = es_order_batch.branch_office_id 
    ORDER BY es_branch_office.ext_code DESC) x) y 
    WHERE y.rowID BETWEEN 1 AND 75

    #2
    Any response? Am I using this incorrectly or it is bug in SQL Data Source?

    Comment


      #3
      Yes, this was an obscure bug, specific to SQL Server. We have committed a fix for this - it will be present in nightly builds as of tomorrow. Also, you can work around the problem by simply switching off SQL limit queries (look in the client-side documentation for DataSource.sqlPaging)

      Comment


        #4
        Is this bug fixed in 3.1 nightly build or 3.0 patched version? I have downloaded latest 3.0 build and still have this issue.

        Comment

        Working...
        X