Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Mysql ListGrid Date Filtering

$
0
0
Using: v9.0p_2013-10-23/Pro Deployment

I've been banging my head against a wall for a while here, and I know I'm just missing something simple. I've got a datasource hooked up to a table in my mysql backend, and a listgrid bound to this datasource.

All I need to do is to ensure proper filtering of my data. Unfortunately, every way I've tried filtering a date column has not been successful. I understand that only the Power editions and above allow for server-side advanced criteria, but surely there has to be some basic date filtering for the Pro users as well? I just don't understand why the filter editor defaults to sending advanced criteria to the server when it's just sending a simple "equals" request.

So in short, what's the correct setup for date filtering in a listgrid with a mysql backend?

My current ds.xml for this datasource:

Code:

<DataSource ID="event_media" serverType="sql"
            tableName="event_media" autoDeriveSchema="true" useAnsiJoins="true">
            <fields>
                    <field primaryKey="true"
                            name="EventID"                hidden="true"                type="sequence" />
                    <field name="globalEventId" hidden="true" />
                    <field name="Event_DeviceID" foreignKey="drivesafe3.DriveSafe3ID"
                            hidden="true"/>
                    <field includeFrom="vehicle.VehicleName" title="Vehicle"
                            readOnlyEditorType="staticText" canEdit="false" />
                    <field name="DriverID" foreignKey="employee.EmployeeID" hidden="true"/>
                    <field includeFrom="employee.EmployeeName" title="Driver Name"
                            canEdit="false" readOnlyEditorType="staticText"/>
                    <field name="Event_TelemetryRecordsID" hidden="true" />
                    <field includeFrom="drivesafe3.Serial" hidden="true" />
                    <field name="State" title="Status">
                            <valueMap>
                                    <value>New</value>
                                    <value>Reviewed</value>
                                    <value>Coached</value>
                                    <value>User-Triggered</value>
                            </valueMap>
                    </field>
                    <field name="Date" type="date" />
                    <field name="image" hidden="true" />
                    <field name="video" hidden="true" />
                    <field name="videoFileId" hidden="true" />
            </fields>
        <operationBindings>
                <operationBinding operationType="fetch" operationId="fetchReviewed">
                        <criteria fieldName="State" value="Reviewed" />
                </operationBinding>
        </operationBindings>
</DataSource>


What gets sent to the server:
Code:

    criteria:{
        operator:"and",
        _constructor:"AdvancedCriteria",
        criteria:[
            {
                fieldName:"Date",
                operator:"equals",
                value:new Date(1389679200000),
                _constructor:"AdvancedCriteria"
            }
        ]
    },
    operationConfig:{
        dataSource:"event_media",
        operationType:"fetch",
        textMatchStyle:"substring"
    },
    startRow:0,
    endRow:75,
    sortBy:[
        "-timeOfEvent"
    ],
    componentId:"isc_ListGrid_1",
    appID:"builtinApplication",
    operation:"event_media_fetch",
    oldValues:{
        operator:"and",
        _constructor:"AdvancedCriteria",
        criteria:[
            {
                fieldName:"Date",
                operator:"equals",
                value:new Date(1389679200000),
                _constructor:"AdvancedCriteria"
            }
        ]
    }
}


And my error:
Code:

DSRequest for DataSource 'event_media' contained AdvancedCriteria, which the DataSource does not support

Viewing all articles
Browse latest Browse all 4756

Trending Articles