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

data wont bind!

3 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig Broadhead
Top achievements
Rank 1
Craig Broadhead asked on 22 Dec 2011, 04:11 PM
Hi I'm using the kendo grid control, i can get the columns to display and if i enter the data using the following method :

  $(document).ready(function(){
      $
("#grid").kendoGrid({
          columns
:[
             
{
                  field
: "FirstName",
                  title
: "First Name"
             
},
             
{
                  field
: "LastName",
                  title
: "Last Name"
         
}],
          dataSource
: {
              data
: [
                 
{
                     
FirstName: "Joe",
                     
LastName: "Smith"
                 
},
                 
{
                     
FirstName: "Jane",
                     
LastName: "Smith"
             
}]
         
}
     
});
 
});


The data will display too, however i am trying to populate the grid from an array and thus am using this method:

 $("#grid").kendoGrid({
     data
: people
 
});

My data however will not appear i just get the column headings, please find my code below:

var Container = document.getElementById("divReportContainer");
    Container.innerHTML = "";
    OutputText += "<table id=\"grid\">";     
    OutputText += "<thead>";
    OutputText += "<th data-field=\"strObjectDescription\">Object Description</th>";
    OutputText += "<th data-field=\"dblPercentageLength\">% of Total Actual Length</th>";
    OutputText += "<th data-field=\"dblActualLength\">Total Actual Length(ft)</th>";
    OutputText += "<th data-field=\"intPlanogramsCount\">Count of Planograms</th>";
    OutputText += "</thead>";
    OutputText += "</table>"
    Container.innerHTML = OutputText;

  $("#grid").kendoGrid();
        var MyArray = [{ strObjectDescription: "Test", dblPercentageLength: "1", dblActualLength: "21", intPlanogramsCount: "3"}];
      


        $("#grid").kendoGrid({
            data: MyArray
        });

please could someone advise where i am going wrong???

3 Answers, 1 is accepted

Sort by
0
Brandon
Top achievements
Rank 1
answered on 22 Dec 2011, 09:56 PM

Just a quick guess, you have an extra grid declaration immediately after the container code:

$("#grid").kendoGrid();
0
Craig Broadhead
Top achievements
Rank 1
answered on 23 Dec 2011, 09:30 AM
No the problem was that it should be datasource and not data, documentation is wrong
0
Naveen
Top achievements
Rank 1
answered on 20 Jan 2012, 07:23 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
Craig Broadhead
Top achievements
Rank 1
Answers by
Brandon
Top achievements
Rank 1
Craig Broadhead
Top achievements
Rank 1
Naveen
Top achievements
Rank 1
Share this question
or