khan4019 / tree-grid-directive

Need one or more maintainer for this! comment or email me if you are interested
http://khan4019.github.io/tree-grid-directive/test/treeGrid.html
347 stars 183 forks source link

col_defs not working as expected #127

Open jhnbyrn opened 7 years ago

jhnbyrn commented 7 years ago

My model has a field called "name". By default this shows up with a table header of "name". I'd like it to appear in the header as "Name" so I added the following definition of col_defs:

    $scope.col_defs = [
    { field: "name",
      displayName: "Name"},
    ];

But instead of changing the "name" header to "Name", it simply added an extra column called "Name" with the same data. Am I doing something wrong? Thanks!

torsten-sauer commented 7 years ago

Hi @thinkingbraindog,

sorry for the late response! You should note, that the first column is the "expand property" and is internally called "Name" (with big N). So if you want to change it's heading, you have to provide the expand-on property for the grid.

Example (not full code): In the html page: <tree-grid expand-on="vm.treeExpandProperty" ...

In the controller:

vm.treeExpandProperty = {
        field: "Name",
        displayName: " "
    };