0

Hi – I have two more questions which is taking more time to understand and resolve.

When I expand the Main jqGrid row I need to able to get the selected row column cell values and reset the subgrid navigation url’s(edit,add,delete etc..) by appending the select row column values as query string’s. So when an user edit’s a subgrid item or adds a new item to subgrid the controller should receive the column values from main grid row selected. I’m using subGridBeforeExpand event to capture main grid selected row data and modify subgrid navig properties like setting the edit, add etc url’s.

 <script type="text/javascript">
    function GetAndReset(id) {

          //Not sure how to get selected row column values . I looked into online with various 
         examples of using getRowdata etc but nothing worked.

         //Need to reset the subgrid navig edit,add,delete urls
         jQuery("#ProfileSettingsEdit").jqGrid('navGrid', '#gridpager', {}, { url: url }, { url: 
         url }, {}, {}, {});

    }
  </script>      

  <div id="gridWrapper1" style="display: none">
    @{

        var grid1 = new JqGridHelper<Configuration.Models.Post.ProfileModel>(
            "ServersWS",
            caption: "Server Profiles With One or More Settings",
            hidden: false,
            hiddenEnabled: true,
            dataType: JqGridDataTypes.Json,
            methodType: JqGridMethodTypes.Post,
            pager: true,
            rowsNumber: 10,
            sortingName: "Profile",
            sortingOrder: JqGridSortingOrders.Asc,
            url: Url.Action("GetServersWithSettings"),

            subGridBeforeExpand: "function(id) {GetAndReset(id);}",
            subgridEnabled: true,
            subgridHelper: new JqGridHelper<PlatformConfigurationEditModel>(
                "ProfileSettingsEdit",
                caption: "Edit Settings",
                hidden: false,
                hiddenEnabled: true,
                dataType: JqGridDataTypes.Json,
                methodType: JqGridMethodTypes.Post,
                pager: true,
                rowsNumber: 10,
                sortingName: "Id",
                sortingOrder: JqGridSortingOrders.Asc,
                url: Url.Action("GetEditableProfileSettings"),
                editingUrl: Url.Action("Edit"),
                viewRecords: true,
                autoWidth: true,
                sortable: true)
                .Navigator(new JqGridNavigatorOptions { Search = false },
                    new JqGridNavigatorEditActionOptions { Url = Url.Action
                   ("Update"),CloseAfterAdd = true, CloseAfterEdit = true, Width = 500, Height = 
                   300 },
                    new JqGridNavigatorEditActionOptions { Url = Url.Action("Add"), 
                     CloseAfterAdd = true, CloseAfterEdit = true, Width = 500, Height = 300 },
                    new JqGridNavigatorDeleteActionOptions { Url = Url.Action("Delete") },
                    null, new JqGridNavigatorViewActionOptions { LabelsWidth = "60%" }
                )
                .FilterToolbar(options: new JqGridFilterToolbarOptions
                {
                    StringResult = true,
                    DefaultSearchOperator = JqGridSearchOperators.Cn,
                    AutoSearch = true,
                    SearchOnEnter = false
                }),
                sortable: true
            ).FilterToolbar(new JqGridFilterToolbarOptions
            {
                StringResult = true,
                DefaultSearchOperator = JqGridSearchOperators.Cn,
                AutoSearch = true,
                SearchOnEnter = false,

            });
        @grid1.GetHtml()
    }
</div>

Appreciate you help!.

AthibaN
  • 2,017
  • 1
  • 13
  • 21
user845405
  • 1,269
  • 4
  • 22
  • 40
  • http://stackoverflow.com/questions/5142422/get-id-of-selected-row-in-a-table-html – Matt Bodily Sep 27 '13 at 14:22
  • I'm looking for row data that is expanded.@MattBodily – user845405 Sep 27 '13 at 14:36
  • maybe you can combine the first link with this one to get what you need http://stackoverflow.com/questions/178325/testing-if-something-is-hidden-with-jquery?rq=1 – Matt Bodily Sep 27 '13 at 14:42
  • Not clear with your suggestion- i tried the first one it doesn't work @MattBodily – user845405 Sep 27 '13 at 15:12
  • if the data is expanded the the suggestions in the second link are to use a jquery selector on the row for display: block or whatever css you change to show that row. So thinking if you use the selector from the second link you will get the shown row combined with the first link on how to get different fields from the selected row it will hopefully give you what you need – Matt Bodily Sep 27 '13 at 15:42

0 Answers0