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

5 posts, 0 answers
  1. Abitar
    Abitar avatar
    22 posts
    Member since:
    May 2015

    Posted 26 Aug 2015 Link to this post

    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
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 28 Aug 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Abitar
    Abitar avatar
    22 posts
    Member since:
    May 2015

    Posted 28 Aug 2015 in reply to Eyup Link to this post

    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

  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 02 Sep 2015 Link to this post

    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
  6. Abitar
    Abitar avatar
    22 posts
    Member since:
    May 2015

    Posted 02 Sep 2015 in reply to Eyup Link to this post

    Hey Eyup,

    Your solution did work.

    Thank you :D

    Abitar

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017