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

Boolean data type in Grid data source

4 Answers 527 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 02 Dec 2011, 08:35 PM
I have 3 columns returning with my data source that are Boolean values (True/False). I couldn't figure out how to designate them as a data type of Boolean to actually evaluate them, so I'm bringing them back as strings and evaluation them as == "True" or "False".

Is it possible to return them to the grid control as actual Booleans and evaluate them as such?

dataSource: {
    data:
    [
        @foreach (var report in Model.Reports)
        {
            <text>{Id: @report.Id, ReportId: "@report.ReportId", ReportSample: "@report.ReportSample", ReportLegend: "@report.ReportLegend", ReportFaq: "@report.ReportFaq", ReportName: "@report.ReportName"}, </text>
        }
    ],
    schema: {
        model: {
            id: "Id",
            fields: {
                Id: { type: "number" },
                ReportId: { type: "string" },
                ReportSample: { type: "string" },
                ReportLegend: { type: "string" },
                ReportFaq: { type: "string" },
                ReportName: { type: "string" }
            }
        }
    }
}

I currently have quotes around the Boolean values being returned:
"@report.ReportSample", "@report.ReportLegend", "@report.ReportFaq"
removing the quotes causes the grid to not display

Thanks for the assistance

4 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 02 Dec 2011, 08:59 PM
dataSource: {
    data: Model.Reports,
    schema: {
        model: {
            id: "Id",
            fields: {
                Id: { type: "number" },
                ReportId: { type: "string" },
                ReportSample: { type: "string" },
                ReportLegend: { type: "string" },
                ReportFaq: { type: "string" },
                ReportName: { type: "string" }
            }
        }
    },
      columns: [
{field: 'Id', title: 'Report Num' },
{field: 'ReportSample', title: 'Sample' }, 
{field: 'ReportLegend', title: 'Legend', template: '<input type="checkbox" checked="#= ReportLegend #" disabled="disabled" /> }, 
{field: 'Id', title: 'Report Num' }, 
{field: 'ReportName', title: 'Name' }, 

]
}
0
Naveen
Top achievements
Rank 1
answered on 20 Jan 2012, 07:21 AM
HI all,
iam getting below error,can any one help me to solve this error.iam getting this eoor while connecting data from database through odata services.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code/>
<message xml:lang="en-IN">
The query parameter '$format' begins with a system-reserved '$' character but is not recognized.
</message>
</error>
0
Naveen
Top achievements
Rank 1
answered on 20 Jan 2012, 07:21 AM
HI all,
iam getting below error,can any one help me to solve this error.iam getting this eoor while connecting data from database through odata services.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code/>
<message xml:lang="en-IN">
The query parameter '$format' begins with a system-reserved '$' character but is not recognized.
</message>
</error>
0
Naveen
Top achievements
Rank 1
answered on 20 Jan 2012, 07:22 AM
HI all,
iam getting below error,can any one help me to solve this error.iam getting this eoor while connecting data from database through odata services.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code/>
<message xml:lang="en-IN">
The query parameter '$format' begins with a system-reserved '$' character but is not recognized.
</message>
</error>

Tags
Grid
Asked by
Philip
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Naveen
Top achievements
Rank 1
Share this question
or