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

[Solved] Customize Commands on Grid

1 Answer 153 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.
Junie
Top achievements
Rank 1
Junie asked on 06 May 2010, 04:08 PM
Hello,

Is there a way where I could customize the toolbar like instead of just a link for the "Add new Record" I would like to change it to an Image? As well as the other predefined commands for inline editing, I want to change those commands to images.

Is there a function (server or client side) where I could initially make the Grid in insert mode? edit mode? I know that there is a query string (?Grid-mode=insert) on the URL that is set every time the Grid is in insert mode or edit mode but I don't know how make that value applicable to Url.Action() function, since "Grid-mode" is an invalid variable for routing.

Regards,
Junie

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 07 May 2010, 07:54 AM
Hi Junie,

Currently you can use the HtmlAttributes method of the commands and assign it a custom css class. Further customization is not supported in the latest release. We plan to add support for icons in a future version of the grid.

If you are using client-side editing (ajax or web service) you can use the following code to put the grid in insert mode:

$('#Grid').data('tGrid').addRow();

To exit from edit mode you can use

$('#Grid').data('tGrid').cancel();

And to edit a particular row you can use:

$('#Grid').data('tGrid').editRow($('#Grid tr:has(td):eq(1)'));

The following $('#Grid tr:has(td):eq(1)') needs further explanation. It is a jQuery selector meaning "the second (eq(1)) row (<tr>) that is bound (has <td>)'.

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.
Tags
Grid
Asked by
Junie
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or