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

[Solved] I need custom commands in rows

9 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank Michael
Top achievements
Rank 1
Frank Michael asked on 04 May 2010, 07:03 PM
I need custom commands in rows. Detail is the minimum, but I need more. I want to be able to call many different actions in many different controllers. Furthermore I hope it is / will be possible to make the buttons smaller, so that more fit into the cell.

9 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 05 May 2010, 07:27 AM
Hello Frank Michael ,

You can use template columns to add buttons to columns.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rafael
Top achievements
Rank 1
answered on 04 Oct 2010, 03:37 PM
hi Atanas,
I have next client template in Ajax binding nested grid
columns.Bound(p => p.ProjectId).ClientTemplate("<button class='t-grid-action t-button t-state-default' id='btnAuth' style='Width: 80px'>Autorise</button>").Width(100).Title(""); 

But I fail to call even alert command from  handler
 $(document).ready(function () {
            $('btnAuth').live('click', function () {
                alert('asd');
            });
        });
OR
 $(document).ready(function () {
            $('btnAuth').bind('click', function () {
                alert('asd');
            });
        });
OR
 $(document).ready(function () {
            $('btnAuth').click( function () {
                alert('asd');
            });
        });




Could you advise what I missed
0
Jigar
Top achievements
Rank 1
answered on 04 Oct 2010, 03:58 PM
Hi Rafael,

Try like this

columns.Bound(p => p.ProjectId).ClientTemplate("<button class='t-grid-action t-button t-state-default' id='btnAuth' style='Width: 80px' onclick=\""OnAutoriseButtonClick(<#= id#>)\"">Autorise</button>").Width(100).Title("");

I hope this helps.

Regards,

Jigar
0
Rafael
Top achievements
Rank 1
answered on 04 Oct 2010, 04:06 PM
doesn't work
0
Jigar
Top achievements
Rank 1
answered on 04 Oct 2010, 04:10 PM
columns.Bound(p => p.ProjectId).ClientTemplate("<input type='button' class='t-button t-state-default' value='Confirm' onclick=\""OnButtonClick(<#= ProjectId#>)\"" />").Width(100).Title("");
This works for me.

Regards,

Jigar.
0
Rafael
Top achievements
Rank 1
answered on 05 Oct 2010, 09:37 AM
Does it work for nested grid?
0
Jigar
Top achievements
Rank 1
answered on 05 Oct 2010, 11:20 AM
Hi Rafael,

It should work, Though I have not tested it.

Regards,

Jigar
0
Rafael
Top achievements
Rank 1
answered on 06 Oct 2010, 08:18 AM
hi Jigar,
I forced it works with such a way
 columns.Bound(p => p.ProjectId).ClientTemplate("<a href='javascript:' class='t-button t-state-default' onclick=\"OnAutoriseButtonClick('<#= ProjectId#>')\">Authorize</a>").Width(100).Title("");
0
Rafael
Top achievements
Rank 1
answered on 11 Oct 2010, 03:14 PM
Another issue here is that when I switch in Edit mode ProjectId column becames visible and displays real ID from db.
When I add ReadOnly(true) to keep template then I get empty value for ProjectId in controller method   
Any ideas how to avoid such an issue?
Tags
Grid
Asked by
Frank Michael
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Rafael
Top achievements
Rank 1
Jigar
Top achievements
Rank 1
Share this question
or