Tuesday 15 July 2014

javascript - angularjs ng-grid dropdown not working with order by -


I have an angular grid (ng-grid) where there is a dropdown on the columns, which is bound to the property Items displayed in rows

  & lt; Div class = "gridStyle span9" ng-grid = "grid option" & gt; & Lt; / Div & gt; $ Scope.types = ['cat', 'dog' 'rat']; $ Scope.gridOptions = {Data: 'AnimalData', columnDefs: [[Field: 'name', displayName: 'name'}, {field: 'birthdays', displayName: 'birthdays'}, {field: 'type' DisplayName : 'Type' cell template: 'cell template' '}}};   

Cell template html:

  & lt; Div & gt; & Lt; Select ng-model = "wildcard [row.rowIndex] .type" & gt; & Lt; Option ng-repeat = "item in type" & gt; {{Item}} & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt;   

It binds my items perfectly well, but when I order my grid, do not place the dropdown order, then they do not change in only one place. Living with values. How would I go about fixing it?

OK, got this issue. To render the original object you must change

from AnimalData [row.rowIndex] .type to row.entity.myEditableProperty.type Required

Example:

  & lt; Div & gt; & Lt; Select ng-model = "row.entity.myEditableProperty.type" ng-option = "item for item type" & gt; & Lt; / Select & gt; & Lt; / Div & gt;   

Proof of concept Plunkr:

No comments:

Post a Comment