This is a migrated thread and some comments may be shown as answers.

ng-if and ng-show not working within custom column template

2 Answers 606 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 28 Mar 2016, 06:54 PM

Hi. I'm trying to use the ng-if or ng-show tags within a custom column template. Unfortunately there seems to be no effect when I change the underlying variable.

gridColumns.push({
    field: currentField.FieldName.replace(/ /g, "_"),
    title: currentField.FieldName,
    template: function (dataItem) {
        return $scope.sampleNameTemplate(dataItem);
    }
                         
    //,locked: true
    , width: 250
    , editor: $scope.textBoxCmtEditor
});

 

$scope.showQaQcSamplesEnabled = function () {
    return $scope.showQaQcSamples;
};

In my grid there is no change regardless of what the $scope.showQaQcSamples variable is set to.

 

Any idea how I can get ng-if or ng-show to work correctly within a custom column template?

 

Thanks,

Ian

2 Answers, 1 is accepted

Sort by
0
Ian
Top achievements
Rank 1
answered on 28 Mar 2016, 06:56 PM

I forgot to include my actual template. Here it is:

$scope.sampleNameTemplate = function (dataItem) {
    return '<div>' + dataItem.Name + '<i ng-if="showQaQcSamplesEnabled();" class="fa fa-clone" title="sample text" style="text-align: right; width: 30px;"></i></div> ';
         
};

0
Radoslav
Telerik team
answered on 31 Mar 2016, 07:42 AM
Hello Ian,

I tried to reproduce the described issue on my side but to no avail. On the following link you can find a small example based on your code:
http://dojo.telerik.com/ocAFi/6

Please check it out and let me know what differs in your case. Looking forward for your reply.

Regards,
Radoslav
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Ian
Top achievements
Rank 1
Answers by
Ian
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or