templates

3 posts, 0 answers
  1. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 07 May 2013 Link to this post

    i keep see in code examples, a template  like this
    columns.Template(t => { }).HeaderTemplate("").ClientTemplate(@"
    < a href='javascript: void(0)' class='abutton edit' onclick='editRow(this)' title='button edit'>button edit</a>
    < a href='javascript: void(0)' class='abutton delete' onclick='deleteRow(this)' title='button delete'>button delete</a>")

    if i have to give other parameters to that editRow javascript function or multiple,for example a string something like editRow(this,2,'text',g) can i do it ? and how do i format this in that template context?
    from the above example some parameters are given by value,some by reference.


    and if i write "this" ,always it is interpreted as the sender of that event?it's very insteresting,i write something as a text and it is interpreted as a valid value,in this case a reference.


    Regards,
    Daniel
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 09 May 2013 Link to this post

    Hello Daniel,

    Basically you to pass string you need to surround it with quotes, Since you need to alternate single with double quotes, the second level should be escaped. 

    To see what I mean:

    .ClientTemplate("<a href='javascript: void(0)' class='abutton edit' onclick='editRow(this,\"some string\")' title='button edit'>button edit</a>" +
    "<a href='javascript: void(0)' class='abutton delete' onclick='deleteRow(this)' title='button delete'>button delete</a>");

    The 'this' keyword is the sender - the <a> element from the example above:

    http://stackoverflow.com/questions/6575210/how-to-pass-the-id-of-an-element-that-triggers-an-onclick-event-to-the-event-h


    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 10 May 2013 Link to this post

    ok,thank you for the informations.
Back to Top