UI网格列defs被覆盖

时间:2016-04-03 08:55:33

标签: angularjs

在填充UI网格时,当数据包含更多字段时,UI网格列defs将被覆盖。怎么解决这个?在控制器中,在哪里以及如何解决这个问题?在WEB Api?

为简单起见,未对样本进行过滤:

import {Injectable} from 'angular2/core';
import {Http, Response} from 'angular2/http';
import {Person} from './../customDataClasses/Person'
import 'rxjs/add/operator/map'; 

@Injectable()
export class CourseService {
   constructor(private _http: Http) { }
   getPersons(name:string)  {
       return this._http.get(`Home/GetPersons?name=${name}`)
                          .map((res : Response) => res.json());
   }
}

1 个答案:

答案 0 :(得分:0)

https://github.com/angular-ui/ui-grid/commit/fd154a71f6a7407bce577efebde9f1122274c48b

确保将grid.lateBoundColumns设置为false

这是一个老问题,请确保您拥有最新版本的ng-grid

来自作者:

我知道问题是什么,

  

最初没有数据也没有列定义,所以网格   进入"等待" state并将标志设置为自动   然后,即使您设置了列定义,也会生成列,   当数据点击时,它们会自动生成。我在其中添加了一个修复程序   提交

https://github.com/angular-ui/ui-grid/issues/285

http://jsfiddle.net/ShEB4/9/