Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
How to bind JSON without igDataSource
posted

Hello,

now I would try the new IG jQuery tools, but I have a problem with the grid. I want to bind a JSON response string from a php service to the grid. But the grid does'nt show any data an add a column that I never defined in the code.

$(function () {
      $("#grid1").igGrid({
          columns: [
              { headerText: "ID", key: "id", dataType: "number" },
              { headerText: "Description", key: "description", dataType: "string" },
              { headerText: "Title", key: "title", dataType: "string" },
          ],
          width: '800px',
          dataSource: "json_server.php"
      });
  });

Is it possible to bind the return of "json_server.php" to dataSource?

Thanx

Markus

  • 24671
    posted

    hey Markus,

    Thanks for your feedback. Your code snippet is perfectly fine and should work out of the box. The grid uses the data source control internally, so you don't need to configure it manually by yourself, and only then passing an instance of it. Several things i can suggest, that can help you locate the issue:

    1) is the json data located directly in the root of the response? If not, you'd probably need to specify a responseDataKey. if you can show me the format of your response i can give you more details on this

    2) is the grid generating a request to your json_server.php, and is it returning with code 200 ? You can easily check this by checking with tools such as Firebug's Net tab. 

    3) do the column types match, meaning that is the ID column indeed a  number, etc. ?

     

    Thanks again,

    Angel