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

RadGrid Batch - How to retreive data from editor form using javascript

6 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abitar
Top achievements
Rank 1
Abitar asked on 26 Aug 2015, 03:59 PM
Hello,
I am using a RadGrid Batch mode (row edit) with GridButtonColumn to open a PopUp (RadWindow), All this happens on client side.
In the grid I have data fields like Name, birth date, etc. I need to retreive data filled in the current row and show them in the PopUp. 
I need to do this using JavaScript. 
 I used this function on the OnClientShow event of the RadWindow : 
                var grid = $find("<%=RadGrid.ClientID%>");
                var tableView = grid.get_masterTableView();
                var batchManager = grid.get_batchEditingManager();
                var items = tableView.get_dataItems();
                var mapCell = items[index].get_cell("Nom");
                var mapValue = batchManager.getCellValue(mapCell);
                alert(mapValue);
It worked when I fill the new record's details in the RadGrid and I unselect the row (I exit Edit mode) then I click on the GridButtonColumn in that row.
But when I click on the button in the new row when its in edit mode, this function returns nothing.
In other words, I need to retreive data from editor form of a RadGrid Batch using JavaScript.
Any one can help ?
Thanks for your help !
Abbas B

6 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 28 Aug 2015, 01:53 PM
Hi Abbas,

Please note that you should name your RadGrid something different than "RadGrid" - for instance "RadGrid1".

I've created a sample RadGrid web site to test the described behavior. Could you run the attached application and let me know about the result?

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Abitar
Top achievements
Rank 1
answered on 28 Aug 2015, 02:29 PM

Hey Eyup,

Thank you for your advice about naming the RadGrid but this is a code sample that I provided, the name in my real code is different.

About your sample project, its working well but the RadGrid is in edit mode type = "Cell".

What I need is exactly the same behavior as in your example, but when edit mode type is = "Row". Is it possible ?

Regards,

Abitar

0
Eyup
Telerik team
answered on 02 Sep 2015, 11:37 AM
Hi Abitar,

In this case add the following line to your logic:
function windowShow(sender, args) {
    var grid = $find("<%=RadGrid1.ClientID%>");
    grid.get_batchEditingManager()._tryCloseEdits(document);
    ...

That should do the trick. Looking forward to your reply.

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Abitar
Top achievements
Rank 1
answered on 02 Sep 2015, 11:59 AM

Hey Eyup,

Your solution did work.

Thank you :D

Abitar

0
MV
Top achievements
Rank 1
answered on 03 Mar 2017, 04:30 PM

Hello,

What is the equivalent for closing InPlace Editing on client side?

I have a RadGrid with a GridClientSelectColumn, I would like to close edits when GridClientSelectColumn is clicked.

Thanks

0
Eyup
Telerik team
answered on 08 Mar 2017, 06:35 AM
Hi,

You can use the fireCommand to achieve this requirement:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridtableview-object/methods/firecommand

You can try with Cancel or CancelAll. Bear in mind that since the InPlace editing mode is a server-side generated form, this action will cause a postback or AJAX request.

I hope this will prove helpful.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Abitar
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Abitar
Top achievements
Rank 1
MV
Top achievements
Rank 1
Share this question
or