Author Topic: Empty rows on grid  (Read 4076 times)

derek

  • Newbie
  • *
  • Posts: 6
    • View Profile
Empty rows on grid
« on: June 24, 2014, 07:59:25 pm »
Hi,

I'm using the grid to display remote records like this example  http://paramquery.com/demos/filter

The records returned 5 rows for example, and the grid display them, but the grid display these all empty.
Can someone help me?

My .net code returns looks like    String response = "{\"data\":" + json + "}";
                                                    return this.Content(response, "text/text");

and my Js datamodel

var dataModel = {
        location: "remote",
        sorting: "remote",
        paging: "remote",
        dataType: "JSON",
        method: "GET",
        curPage: 1,
        rPP: 5,
        sortIndx: 2,
        sortDir: "up",
        rPPOptions: [1, 5, 20, 30, 40, 50, 100, 500, 1000],
        filterIndx: "",
        filterValue: "",
        fields: ['IdClasseInstrumento', 'Classe', 'Descricao', 'TipoPessoa', 'RPPS'],
        getUrl: function () {
            var sortDir = (this.sortDir == "up") ? "asc" : "desc";
            var queryString = "cur_page=" + this.curPage + "&records_per_page=" +
                this.rPP + "&sortBy=" + this.fields[this.sortIndx] + "&dir=" + sortDir;
            if (this.filterIndx != null && this.fields[this.filterIndx]) {
                queryString += "&filterBy=" + this.fields[this.filterIndx] + "&filterValue=" + this.filterValue;
            }
            var obj = { url: "/ClasseInstrumento/Load", data: queryString };
            return obj;
        },
        getData: function (dataJSON) {
            return { data: dataJSON.data };
           // return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert(textStatus);
        }
    }



paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Empty rows on grid
« Reply #1 on: June 24, 2014, 08:17:03 pm »
what's the colModel. dataIndx in columns should match with those in the rows.

derek

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Empty rows on grid
« Reply #2 on: June 24, 2014, 10:25:44 pm »
Hi,

That's it!!! I forgot to set dataIndx property in my colModel!

Thank you so much