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

Don't want to show all columns in a grid

1 Answer 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 11 Jun 2012, 06:59 PM
I have a JSON object that I get back from a Web Service that is a collection of 8 fields. I only want to show 4 of them in my grid. If I don't put the fields in the columns list then it doesn't show the column headers (as expected) but it still shows the columns. I have tried defining schema / model / fields to see if that would help (basically leaving those columns out), it didn't.

Right now I am using JavaScript to hide the columns but is there a better way to do this? For instance, is there a property which only maps what is defined as a column?

Thanks,
Peter

    // initialize the grid, if it hasn't already been initialized
    if ($("#JobPostingsGrid").html().length < 1) {
        $("#JobPostingsGrid").kendoGrid({
            columns: [
              { field: "OpeningNum", title: "#", width: 80 },
              { field: "Title" },
              { field: "Recruiter" },
              { field: "Location" }],
            height: 600,
            scrollable: true,
            sortable: true,
            dataSource: {
                data: postings,
            },
            rowTemplate: kendo.template($("#JobPostingsRowTemplate").html()),
            selectable: "row"
        });
    }

1 Answer, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 11 Jun 2012, 09:35 PM
Actually this was a dumb mistake on my part, the row template I was using had the fields listed so that's why they were showing. When I fixed that and removed the columns all was ok.
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Share this question
or