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

Client delete row

3 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yan St-Yves
Top achievements
Rank 1
Yan St-Yves asked on 25 Apr 2008, 12:30 AM
Hi,

Is it possible to implement the exact same behavior that the one we have with the 

GridClientDeleteColumn

in an Image OnClick client event in a template column?

I mean the same behavior in the same order. The GridClientDeleteColumn make the row disapear before doing any custom ajaxrequest.

That gives a pretty nice user interaction, but i want it in a image in a template column if it can be possible.

So the real question is, can i delete a row from a client event other that the one on the GridClientDeleteColumn  so that the OnRowDeleted client event is raised.

Thanks,

3 Answers, 1 is accepted

Sort by
0
Yan St-Yves
Top achievements
Rank 1
answered on 25 Apr 2008, 01:19 AM

After some research and some tries, I can achieve the same behavior with this code in a JS function receiving the index in parameter:

var masterTable = $find("<%=rgTypeDepense.ClientID%>").get_masterTableView();

var dataItem = masterTable.get_dataItems()[index];

dataItem.set_visible(

false);

var masterTable = $find("<%= rgTypeDepense.ClientID %>").get_masterTableView();

masterTable.fireCommand(

"Delete",index);

I think this will do the job.

I'm just curious, is there a better code that can raise the 'OnRowDeleted' client event?

The fireCommand call directly the ItemCommand server event.

0
Yan St-Yves
Top achievements
Rank 1
answered on 25 Apr 2008, 01:27 AM
The only downside with the method mentionned above is that the e.Canceled in the itemCommand doesn't seems to work Where fired up from the image.

It's working fine with the GClientDelColumn.
0
Iana Tsolova
Telerik team
answered on 25 Apr 2008, 11:06 AM
Hello Yan St-Yves,

The OnRowDeleted client-side event is fired when the delete button of the GridClientDeteColumn is clicked. And if you want to use an image as a delete button, I would suggest you to set the ButtonType property of the column to ImageButton and accordingly set its ImageUrl property too.

Unfortunately I couldn't replicate the problem described in your last post. Please find attached a sample project and let me know if I missed something from the logic.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Yan St-Yves
Top achievements
Rank 1
Answers by
Yan St-Yves
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or