Angular column template function

4 posts, 0 answers
  1. Tim
    Tim avatar
    8 posts
    Member since:
    Nov 2012

    Posted 20 Aug 2014 Link to this post

    I have the need to generate custom HTML by converting each data item returned for a given column when using Angular MVVM.

    It seems that I can get the function called when it exists in the controller scope, but the HTML I return doesn't seem to be formatted in the column it just treats it as plain text.

    { "field": "note",
    "title": "Notes",
    width: "60%",
    template: "<span ng-bind=formatNote(dataItem.note)>#= data.note# </span>"
    }

    $scope.formatNote = function(data) {
            return data.replace(/ /g,"<p>");
    };
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 22 Aug 2014 Link to this post

    Hello Tim,

    I am not sure what exactly you are trying to achieve. Inside the template you have multiple ways to format your column - you can use either angular template expressions such as {{ }} and kendo expressions such as #= #.

    http://dojo.telerik.com/@pesho/iMASa

    Also you can use external function from the controller scope like so:

    http://dojo.telerik.com/@pesho/iMASa/2

    Combining kendo templates + angular templates should give you all the possible freedom.

    ===

    Update: Here is a similar example with a 2016 version of Kendo UI 


    http://dojo.telerik.com/AtURa


    Kind Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Nelson
    Nelson avatar
    2 posts
    Member since:
    Nov 2015

    Posted 02 May 2016 in reply to Petur Subev Link to this post

    Petur, 

    When an Angular template expression is used inside the column template, does it allow you to utilize the PDF export still? 

    When I export to PDF the column is showing the literal string for the template. {{ dataItem.FirstName }}

  4. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 04 May 2016 Link to this post

    Hello Nelson,

    It seems to be working in this example - http://dojo.telerik.com/@rusev/IrULE

    Am I missing something here?

    Regards,
    Nikolay Rusev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top