Javascript cellTemplate中的AngularJS ui网格排序
我对UI-GRID中的排序功能有问题。 目前,我通过以下方式接收数据:Javascript cellTemplate中的AngularJS ui网格排序,javascript,angularjs,angular-ui-grid,ui-grid,Javascript,Angularjs,Angular Ui Grid,Ui Grid,我对UI-GRID中的排序功能有问题。 目前,我通过以下方式接收数据: { AccountID : 555, Teacher: Somename, SchoolName: 1 }, { AccountID : 555, Teacher: Somename, SchoolName: 2 } 等等 我正在用口述法记录我的学名,并用以下方式将它们形象化: if ( memberData.type == "dictionary" ) { columnDef.cellTemplate = '<
{
AccountID : 555,
Teacher: Somename,
SchoolName: 1
},
{
AccountID : 555,
Teacher: Somename,
SchoolName: 2
}
等等
我正在用口述法记录我的学名,并用以下方式将它们形象化:
if ( memberData.type == "dictionary" ) {
columnDef.cellTemplate =
'<div class="ui-grid-cell-contents">
{{ grid.appScope.GetDictionaryItemValue( "' + memberData.dictionaryID + '", COL_FIELD ) }}
</div>';
if(memberData.type==“dictionary”){
columnDef.cellTemplate=
'
{{grid.appScope.GetDictionaryItemValue(“+memberData.dictionaryID+”,COL_字段)}
';
这里的问题是排序功能是对学校进行排序
不是通过口述姓名收到的,而是根据他们的ID
这个问题的最佳解决方案是什么?
我尝试使用cellFilter而不是cellTemplate,但它也会按ID对它们进行排序。刚刚使用cellFilter再次尝试,实际上它是这样工作的:
columnDef.cellFilter = 'dictionaryFilter:"' + this + '"';
columnDef.sortCellFiltered = true;
目前,这是我的手动筛选代码:
.filter( 'dictionaryFilter', function() {
return function( input ) {
if (input == 2) {
input = 'High School';
}
if (input == 3) {
input = 'Other School';
}
if (input == 16) {
input = 'Another School';
}
return input;
}
有没有办法从此筛选器访问父控制器作用域?我不想在筛选器中硬核命令