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

HelperResult in template column

4 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 17 Sep 2015, 05:05 AM

Is it possible to display a helper in a template like this? I'm getting errors.  Maybe I'm not formatting it correctly?

 

columns.Template(template => RenderCustomerActions(template.CustomerID, template.HasMoveHistory));

 @helper RenderCustomerActions(int customerID, bool hasMoveHistory)
{
    <button type='button' id='openCustomerEditButton' title='Edit Customer' onclick='openCustomerEditWindow(@customerID, false, this);' class='k-button k-button-icon' data-toggle='tooltip'><span class='k-icon k-edit'></span></button>
    <button type='button' title='Delete Customer' onclick='deleteCustomer(@customerID, @hasMoveHistory);' class='k-button k-button-icon' data-toggle='tooltip'><span class='k-icon k-delete'></span></button>
    <div class="btn-group">
        <button type="button" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown"><i class="fa fa-caret-down"></i></button>
        <ul class="dropdown-menu" role="menu">
            <li><a onclick="openCustomerPaymentAddWindow(@customerID);">Add Payment</a></li>
        </ul>
    </div>
}

 

I've also tried this the dropdown menu will show but it wont expand:

 

  columns.Template(@<text></text>).ClientTemplate("<button type='button' id='openCustomerEditButton' title='Edit Customer' onclick='openCustomerEditWindow(#=CustomerID#, false, this);' class='k-button k-button-icon' data-toggle='tooltip'><span class='k-icon k-edit'></span></button>" +
            "<button type='button' title='Delete Customer' onclick='deleteCustomer(#=CustomerID#, #=HasMoveHistory#);' class='k-button k-button-icon' data-toggle='tooltip'><span class='k-icon k-delete'></span></button>" +
            "<div class='btn-group'>" +
            "<button type='button' class='btn btn-primary btn-xs dropdown-toggle' data-toggle='dropdown'><i class='fa fa-caret-down'></i></button>" +
            "<ul class='dropdown-menu' role='menu'>" +
            "<li><a onclick='openCustomerPaymentAddWindow(#=CustomerID#);'>Add Payment</a></li>" +
            "</ul>" +
            "</div>").Title("").Width(100);

4 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 21 Sep 2015, 07:45 AM

Hello Joseph,

> Is it possible to display a helper in a template like this?
No, this functionality is not supported at this time.

> I've also tried this the dropdown menu will show but it wont expand:
Do you initialize the drop-down menus after the Grid items have been loaded?

.Events(ev => ev.DataBound("onDataBound"))

function onDataBound(e) {
    e.sender.element.find('[data-toggle="tooltip"]').tooltip()
}

If this suggestion does not help, please provide a runnable sample project that shows the problem.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Joseph
Top achievements
Rank 1
answered on 09 Nov 2015, 09:04 AM

Yes, on my databound event on my grid I have:

  $(function () {
$('.dropdown-toggle').dropdown()
})

 and the dropdown doesn't render in the grid.

 

0
Joseph
Top achievements
Rank 1
answered on 09 Nov 2015, 09:12 AM

I also tried

e.sender.element.find('.dropdown-toggle').dropdown()

Still not working though

0
Alex Gyoshev
Telerik team
answered on 11 Nov 2015, 11:31 AM

Hello Joseph,

Can you please provide an isolated runnable example so that we can determine the issue of the problem?

Regards,
Alex Gyoshev
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
Joseph
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Joseph
Top achievements
Rank 1
Share this question
or