複数の値を持つセルテーブルが必要です。私はui-gridオプションのための構造を作った、セルのためのカスタムテンプレートといくつかのCSSの行。それは働き、私は値が同じ行または複数の行にとどまらなければならないかどうかを決定することができます。ui-gridでグループ化されたカスタムセルテンプレートの動的角度フィルタ
カスタムテンプレート:
var template =
'<div class="ui-grid-cell-contents crm-group">'+
'<div class="crm-group-row" ng-repeat="rowFields in col.colDef.fields">' +
'<div class="crm-group-col" ng-repeat="colField in rowFields" ng-if="row.entity[colField.name]">' +
'<span class="title" ng-if="colField.descr">'+
'{{colField.descr}}: '+
'</span>' +
'<span class="content">'+
//"{{row.entity[colField.name] }}"+ //without filter
"{{row.entity[colField.name] | colField.cellFilter}}"+ //<-- HERE doesn't work
'</span>' +
'</div>'+
'</div>' +
'</div>';
オプション構造:
{ field: 'group',
name: 'Group',
width: '**',
fields : [
[
{
name: "age",
descr: "Num",
cellFilter : "floatToFixed:'2'",
},
{
name: "email",
descr: "Email",
},
],
],
cellTemplate: template
},
は、今私は、各値に可能な異なるフィルタを適用する必要があります。だから私はフィールドの構造に設定します。この場合、最初のフィールド値にカスタムフィルタを適用します。
フィルタ:
app.filter('floatToFixed', function() {
return function (input, number) {
console.log(input);
console.log(number);
if (!input)
return null;
if (!number)
return input;
else
return parseFloat(input).toFixed(parseInt(number));
}
});
しかし、それは動作しません。 Hereはプランカです。
ヘルプは感謝しています。
http://stackoverflow.com/questions/21491747/apply-formatting-fiダイナミック・イン・ア・ジ・リピートこれはあなたの問題に答える – Kliment