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

Button in KendoGrid

3 Answers 325 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 09 Jan 2012, 04:58 PM


Hi everyone! I'm testing this new API and i really like it, but I'm trying to put a personal button in a kendoGrid field, but i don't really know how to made this.

I look in the documentation, and anything in it help me to solve my problem.

I've tried to put some HTML in it, but i didn't find an associated type for HTML insertion.

So how can i instantiate a button in my kendoGrid.

Thank you !
 

3 Answers, 1 is accepted

Sort by
0
Tyler
Top achievements
Rank 1
answered on 10 Jan 2012, 04:06 PM
My question is it too stupid to deserve an answer?
0
John Thompson
Top achievements
Rank 2
answered on 20 Jan 2012, 02:40 PM
Have you tried using row templates?  I have a billing related application and I use links and buttons within the kendoGrid.

<script id="rowTemplate" type="text/x-kendo-template">
    <tr>
        <td style="text-align: center">
            <a class="invoiceNumber" href="\#">${InvoiceNumber}</a>
        </td>
...

You can then use jQuery in the dataBound event to attach a delegate to the click event.

dataBound: function ()
{
    this.expandRow(this.tbody.find("tr.k-master-row").first());
 
    $("#worklistGrid").delegate(".invoiceNumber", "click", setStatus);
}



0
Amol
Top achievements
Rank 1
answered on 24 Jan 2012, 01:06 PM
Hope this helps

{ field: "ItemName",
   template: "<div><table><tr><td width='150px'>${ ItemName }</td><td><input id='btnOpenDialog'      type='button' style='background-image:url(glass.png)'onclick='javascript:onclick(\"#=ItemCode#\");' /></td></tr></table><div>", width: "200px" },

This will show an button with image and when clicked will run 'onclick'  javascript function
Tags
Grid
Asked by
Tyler
Top achievements
Rank 1
Answers by
Tyler
Top achievements
Rank 1
John Thompson
Top achievements
Rank 2
Amol
Top achievements
Rank 1
Share this question
or