I'm trying to translate Ui-grid in angular but i can't . i just want to translate columnDefs
.
here is my controller :
$scope.gridOptions = {
enableSorting: true,
columnDefs: [
{ name: 'نمایش', cellClass: "editCell", cellTemplate: '<i id="editBtn" tooltip-placement="left" tooltip="نمایش درخواست" class="fa fa-eye" ng-click="getExternalScopes().editUser(row.entity.RequestCode)" ></i>', headerClass: 'JobHeader' },
{
name: 'کد شهر', headerClass: 'cityHeader', field: 'CityCode', editableCellTemplate: self.editableCellTempate,
enableCellEdit: true
},
{ name: 'کد امور', field: 'RgnCode' },
{ name: 'شماره درخواست', field: 'RequestCode' },
],
};
i want to translate name in columnDefs
Any idea ?
Use
in colummDefs
I used {field:'id', displayName:'ID_TRANSLATION_KEY', headerFilter:'translate'}
. It works like usual template translation. Only problem with your solution you may be losing default sorting functionality offered by the component (have to create your own) when you use headerCellTemplate
.
I think this may help someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With