无法从AngularJS中的JSON对象检索ng-grid值

时间:2014-08-11 05:40:31

标签: json angularjs

这是我从两个表加入的JSON对象..

[{"a.opp_name" : "fff",
  "b.client_name" : "Burlington Pension",
  "a.opp_value" : "2.0",
  "a.opp_target_date" : "2014-08-08",
  "d.parameter_name" : "WON",
  "a.opp_rm" : "Lisa Hayden",
  "a.opp_probability" : "43",
  "c.parameter_name" : "Fixed Income",
  "a.opp_next_step" : ""}]

这是Javascript文件。

$scope.gridOptions = {      
        data : 'Values',
        selectedItems: $scope.mySelections,
        multiSelect: false,
        columnDefs: [
          {field:'opp_key', displayName:'Opportunity Key',visible:false},
          {field:'opp_name', displayName:'Name', cellTemplate: '<div>{{a.opp_name[0]}}</div>'},
          {field:'b.client_name', displayName:'Client' },
          {field:'a.opp_value', displayName:'Target Amount' },
     // ,  cellTemplate:'<div>${{row.entity.opp_probability}}M <div>'    | date : MM-dd-yy
          {field:'a.opp_target_date', displayName:'Target Date'},
          {field: 'd.parameter_name',displayName:'Stage'},
          {field:'a.opp_rm', displayName:'Owner'},
          {field:'a.opp_probability', displayName:'Probability', },
          // cellTemplate:'<div><progress id="progressBar" data-ng-model="row.entity.opp_probability" data-ng-value="row.entity.opp_probability=convert(row.entity.opp_probability)" max="100" style="width: 50px;"></progress>&nbsp; {{row.entity.opp_probability}}%</div>'
          {field:'c.parameter_name', displayName:'Mandate'}, 
          {field:'a.opp_next_step', displayName:'Next Step'}]
};

从这里我们没有得到ng-grid中的值..

1 个答案:

答案 0 :(得分:-1)

对于这个问题,我们使用代理名称作为相同的keyname..here参数名称来两次。所以我们可以使用代理名称来区分这两个参数名称。

喜欢这个..

ColumnNames =“opp_key,opp_name,client_name,opp_value,opp_target_date,parameter_name,opp_rm,opp_probability,parameter_name,opp_next_step,user_first_name”;

SurrogateNames = “opp_key,opp_name,CLIENT_NAME,opp_value,opp_target_date,舞台,opp_rm,opp_probability,授权,opp_next_step,USER_FIRST_NAME”;