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

3 posts, 0 answers
  1. Ian
    Ian avatar
    12 posts
    Member since:
    Feb 2016

    Posted 28 Mar 2016 Link to this post

    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. Ian
    Ian avatar
    12 posts
    Member since:
    Feb 2016

    Posted 28 Mar 2016 in reply to Ian Link to this post

    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> ';
             
    };

  3. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 31 Mar 2016 Link to this post

    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!
     
Back to Top