jQWidgets Forums

jQuery UI Widgets Forums Grid nested grid

This topic contains 2 replies, has 2 voices, and was last updated by  jperera 10 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    nested grid Posts
  • nested grid #69379

    jperera
    Participant

    Hello everybody,
    I’m working with a grid that i have a Nested grid inside and i have a problem because in the nested grid a have a button to do a operation but in the button click I need to get the row data but i can’t find the way to get the row data, please could help me with this??
    This is the code that i’m using:

     var initrowdetails = function (index, parentElement, gridElement, record) {
                var params = "{" + "'EventRecordId':" + record.EventRecordId + "}";
                var grid = $($(parentElement).children()[0]);
                $.ajax({
                    type: "POST",
                    url: '@Url.Action("LoadSureViewVideo", "AccountHistory")',
                    data: params,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var videoSource = {
                            datatype: "json",
                            datafields: [
                                { name: 'EventRecordId', type: 'string' },
                                { name: 'FileId', type: 'string' },
                                { name: 'Title', type: 'string' }
                            ],
                            localdata: data
                        }
                        var dataAdapter = new $.jqx.dataAdapter(videoSource);
                        if (grid != null) {
                            grid.jqxGrid({
                                width: "100%",
                                theme: 'bootstrap',
                                source: dataAdapter,
                                height: 100,
                                altrows: true,
                                sortable: true,
                                pageable: true,
                                pagesize: 20,
                                columnsresize: true,
                                enableellipsis: true,
                                selectionmode: 'singlerow',
                                columns: [
                                  { text: 'Title', datafield: 'Title', width: 150 },
                                  { text: 'FileId', datafield: 'FileId', width: 400 },
                                  {
                                      text: 'Show', datafield: 'Show', width: 40, columntype: 'button', cellsrenderer: function () {
                                          return 'Show';
                                      }, buttonclick: function (row) {
                                          var dataRecord = $("#gridNestedEventRecord" + row).jqxGrid('getrowdata', row);
                                          var rep = document.getElementById('videoPlay');
                                          function addSourceToVideo(element, src, type) {
                                              var source = document.createElement('source');
                                              source.src = src;
                                              source.type = type;
                                              element.appendChild(source);
                                          }
                                          var par = "{" + "'EventRecordId':'" + record.EventRecordId + "'," + "'FileId':'" + dataRecord.FileId + "'}";
                                          $.ajax({
                                              type: "POST",
                                              url: '@Url.Action("DownloadSureVideo", "AccountHistory")',
                                              data: par,
                                              contentType: "application/json; charset=utf-8",
                                              dataType: "json",
                                              success: function (data) {
                                                  addSourceToVideo(rep, data, 'video/mp4');
                                              }
                                          });
                                          $('#popupWindowPlayVideo').jqxWindow('open');
                                      }
                                  }
    
                                ]
    
                            });

    the problem is in this line when i’m trying to get the rowdata:
    var dataRecord = $(“#gridNestedEventRecord” + row).jqxGrid(‘getrowdata’, row);

    Thank you for your help
    Jose

    nested grid #69416

    Dimitar
    Participant

    Hello Jose,

    Please try with:

    var dataRecord = grid.jqxGrid('getrowdata', row);

    The grid variable stores the jQuery selection of the current nested grid.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    nested grid #69429

    jperera
    Participant

    Thank you very much Dimitar, you are right!!!

    Jose

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.