Announcement

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

    grid filtering problem using 'date' and 'select' fields.

    SmartClient Version: v11.0p_2016-08-12/Enterprise Development Only (built 2016-08-12)

    Chrome on OSX

    please modify the #adaptiveFilter sample like this:
    Code:
    isc.ListGrid.create({
        ID: "supplyList",
        width:500, height:300, alternateRecordStyles:true,
        dataSource: supplyItem,
        canEdit:true,
        fields:[
            {name:"SKU"},
            {name:"itemName"},
            {name:"description"},
            {name:"category"},
            {name:"units"},
            {name:"nextShipment"}
        ],
        autoFetchData: true,
        showFilterEditor: true,
        filterOnKeypress: true,
        fetchDelay: 500
    });
    
    // ---------------------------------------------------------------------------------------
    // The code that follows is just to illustrate when SmartClient has needed to contact the
    // server. It is not part of the example.
    var origBGColor,
        restoreBGColorTimerID;
    supplyItem.addProperties({
    
        transformResponse: function (dsResponse) {
            if (this.dataFormat == "iscServer") this.updateRowCountLabel(dsResponse);
        },
        // This approach logs simulated server trips for SmartClient LGPL, where all DataSources
        // in the Feature Explorer are converted to clientOnly:true so that no server is required.
        getClientOnlyResponse : function (dsRequest) {
            var dsResponse = this.Super("getClientOnlyResponse", arguments);
            this.updateRowCountLabel(dsResponse);
            return dsResponse;
        },
        updateRowCountLabel : function (dsResponse) {
            serverCount.incrementAndUpdate(dsResponse.totalRows,
                                           dsResponse.startRow,
                                           dsResponse.endRow);
            // Flash the label
            if (restoreBGColorTimerID == null) origBGColor = serverCount.backgroundColor;
            else isc.Timer.clear(restoreBGColorTimerID);
            serverCount.setBackgroundColor("#ffff77");
            restoreBGColorTimerID = isc.Timer.setTimeout(function () {
                restoreBGColorTimerID = null;
                serverCount.setBackgroundColor(origBGColor);
            }, 500);
        }
    })
    var serverCount = isc.Label.create({
        top: 320, padding: 10,
        width: 500, height: 40,
        border: "1px solid grey",
        contents: "<b>Number of server trips: 0</b>",
        count: 0,
        incrementAndUpdate: function (totalRows, startRow, endRow) {
            this.count++;
            this.setContents("<b>Number of server trips: " + this.count +
                             "<br/>Total rows in this filter set: " + totalRows +
                             "<br/>Last range of records returned: " +
                             startRow + " to " + endRow + "</b>");
        }
    });
    Steps to reproduce:
    1. Enter some 'Next Shipment' dates, for example 'today' for two items with 'Roll' units, and 'today' for an item with 'Ea' units.
    2. Filter by 'Next Shipment': enter 'from' -> today, and 'to' -> today. You'll see the 3 edited records.
    3. Filter by 'Units': select 'Roll', you'll see 2 records.
    4. Filter by 'Units': select the empty value from the pickList, and you'll see no change, the grid still contains 2 records.

    #2
    We've made some changes to fix this and some related issues - please retest with a build dated August 23 or later.

    Comment


      #3
      SmartClient Version: v11.0p_2016-08-24/Enterprise Development Only (built 2016-08-24)

      I can confirm it's fixed, thank you very much.

      Comment


        #4
        SmartClient Version: v11.0p_2016-08-24/Enterprise Development Only (built 2016-08-24)

        Chrome on OSX

        Hello, I've found another bug with a little variation on the test case.

        please modify the dataSource of the #adaptiveFilter sample like this:
        Code:
        <DataSource
            ID="supplyItem"
            tableName="supplyItem"
            titleField="itemName"
            testFileName="/examples/shared/ds/test_data/supplyItem.data.xml"
            dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"
        >
            <fields>
                <field name="itemID"      type="sequence" hidden="true"       primaryKey="true"/>
                <field name="itemName"    type="text"     title="Item"        length="128"       required="true"/>
                <field name="SKU"         type="text"     title="SKU"         length="10"        required="true"/>
                <field name="description" type="text"     title="Description" length="2000"/>
                <field name="category"    type="text"     title="Category"    length="128"       required="true"
                       foreignKey="supplyCategory.categoryName"/>
                <field name="units"       type="enum"     title="Units"       length="5">
                    <valueMap>
                        <value>Roll</value>
                        <value>Ea</value>
                        <value>Pkt</value>
                        <value>Set</value>
                        <value>Tube</value>
                        <value>Pad</value>
                        <value>Ream</value>
                        <value>Tin</value>
                        <value>Bag</value>
                        <value>Ctn</value>
                        <value>Box</value>
                    </valueMap>
                </field>
                <field name="unitCost"    type="float"    title="Unit Cost"   required="true">
                    <validators>
                        <validator type="floatLimit" precision="2" min="0" errorMessage="Please enter a valid cost"/>
                    </validators>
                </field>
                <field name="inStock"   type="boolean"  title="In Stock"/>
                <field name="nextShipment"  type="datetime" title="Next Shipment"/>
            </fields>
        </DataSource>
        I've changed the type of the nextShipment field from 'date' to 'datetime'.

        Then run this js code:
        Code:
        isc.ListGrid.create({
            ID: "supplyList",
            width:500, height:300, alternateRecordStyles:true,
            dataSource: supplyItem,
            canEdit:true,
            fields:[
                {name:"SKU"},
                {name:"itemName"},
                {name:"description"},
                {name:"category"},
                {name:"units"},
                {name:"nextShipment", type:"date"}
            ],
            autoFetchData: true,
            showFilterEditor: true,
            filterOnKeypress: true,
            fetchDelay: 500
        });
        
        // ---------------------------------------------------------------------------------------
        // The code that follows is just to illustrate when SmartClient has needed to contact the
        // server. It is not part of the example.
        var origBGColor,
            restoreBGColorTimerID;
        supplyItem.addProperties({
        
            transformResponse: function (dsResponse) {
                if (this.dataFormat == "iscServer") this.updateRowCountLabel(dsResponse);
            },
            // This approach logs simulated server trips for SmartClient LGPL, where all DataSources
            // in the Feature Explorer are converted to clientOnly:true so that no server is required.
            getClientOnlyResponse : function (dsRequest) {
                var dsResponse = this.Super("getClientOnlyResponse", arguments);
                this.updateRowCountLabel(dsResponse);
                return dsResponse;
            },
            updateRowCountLabel : function (dsResponse) {
                serverCount.incrementAndUpdate(dsResponse.totalRows,
                                               dsResponse.startRow,
                                               dsResponse.endRow);
                // Flash the label
                if (restoreBGColorTimerID == null) origBGColor = serverCount.backgroundColor;
                else isc.Timer.clear(restoreBGColorTimerID);
                serverCount.setBackgroundColor("#ffff77");
                restoreBGColorTimerID = isc.Timer.setTimeout(function () {
                    restoreBGColorTimerID = null;
                    serverCount.setBackgroundColor(origBGColor);
                }, 500);
            }
        })
        var serverCount = isc.Label.create({
            top: 320, padding: 10,
            width: 500, height: 40,
            border: "1px solid grey",
            contents: "<b>Number of server trips: 0</b>",
            count: 0,
            incrementAndUpdate: function (totalRows, startRow, endRow) {
                this.count++;
                this.setContents("<b>Number of server trips: " + this.count +
                                 "<br/>Total rows in this filter set: " + totalRows +
                                 "<br/>Last range of records returned: " +
                                 startRow + " to " + endRow + "</b>");
            }
        });
        ​
        the test case is the same of the first post, but with type:"date" on the 'nextShipment' field.
        Steps to reproduce:
        1. Enter some 'Next Shipment' dates, for example 'today' for two items with 'Roll' units, and 'today' for an item with 'Ea' units.
        2. Filter by 'Next Shipment': enter 'from' -> today, and 'to' -> today. You'll see the 3 edited records.
        3. Filter by 'Units': selecting 'Roll', results in an empty grid.

        Comment


          #5
          We're not seeing this one - filtering works correctly for us, whether the DS field is of type date or datetime, and whether or not you purposely mismatch the type of the LG field (in your sample, it's a date, but the DS field is a datetime).

          Did you miss any steps from your repro instrauctions?

          Comment


            #6
            Hello, actually I've just reproduced it one more time, than after another cmd-shift-R refresh, I can't reproduce it no more.
            Sorry for the bogus report.

            Comment

            Working...
            X