This is a migrated thread and some comments may be shown as answers.

Number Treated as String for Filter

4 Answers 934 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 28 Dec 2011, 11:36 PM
At least that is what I am assuming. I have a datasource bound to a grid. It is a delayed binding, so the url is set later, but I do get the expected data. When I select the filter item for price I get the following on the console: 
Thanks for your help.
Randy

Data Source:
var myQuotes = new kendo.data.DataSource({
    transport: {
        read: ""
    },
    schema: {
        data: "d",
        schema: {
            model: {
                fields: {
                    Carrier: { type: "number" },
                    ErroMsg: { type: "string" },
                    Key: { type: "string" },
                    Price: { type: "number" },
                    Service: { type: "number" },
                    Sig: { type: "number" },
                    WeightLbs: { type: "number" },
                    WeightOz: { type: "number" }
                }
            }
        }
    }
});

Grid:
    myQuotes.transport.options.read.data = "d";
    myQuotes.transport.options.read.url = 'ws/srvQuickQuote.svc/Quote';
    myQuotes.fetch(function () {
        $("#grid").kendoGrid({
            dataSource: myQuotes,
            height: 600,
            scrollable: true,
            sortable: true,
            filterable: true,
            pageable: true,
            columns: [
                {
                    field: "Carrier",
                    type: "number",
                    title: "Carrier"
                },{
                    field: "Service",
                    type: "number",
                    title: "Service"
                },{
                    field: "Sig",
                    type: "number",
                    title: "Signature"
                },{
                    field: "Price",
                    type: "number",
                    title: "Price"
                },{
                    field: "ErrorMsg",
                    type: "string",
                    title: "ErrorMsg"
                }
            ]
        }
 
        );
    });

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 29 Dec 2011, 09:45 AM
Hello,

 How does the data look like? Can you confirm that Price is serialized as number and not as String? The datasource currently will not convert your data to match the type specified in the model.

Greetings,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Randy
Top achievements
Rank 1
answered on 29 Dec 2011, 03:54 PM
This is the JSON I copied from FireBug. It appears to be a number to me.

Randy

{"d":[{"__type":"QQ_Results:#","Carrier":2,"ErrorMsg":"None","Key":"UPS|3|4|5|6","Price":1,"Service":3,"Sig":4,"WeightLbs":5,"WeightOz":6},{"__type":"QQ_Results:#","Carrier":3,"ErrorMsg":"None","Key":"USPS|4|5|6|7","Price":2,"Service":4,"Sig":5,"WeightLbs":6,"WeightOz":7},{"__type":"QQ_Results:#","Carrier":4,"ErrorMsg":"None","Key":"OnTrac|5|6|7|8","Price":3,"Service":5,"Sig":6,"WeightLbs":7,"WeightOz":8}]}
0
Accepted
Atanas Korchev
Telerik team
answered on 29 Dec 2011, 04:21 PM
Hello,

 I think I found what the problem is. The dataSource has its schema defined twice:

schema: {
      schema: {
      }
}

This is causing the problem. I created a live demo showing the proper configuration:


All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Randy
Top achievements
Rank 1
answered on 29 Dec 2011, 06:05 PM
That fixed itThanks,

I guess I stuttered.

Randy
Tags
Grid
Asked by
Randy
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Randy
Top achievements
Rank 1
Share this question
or