jQWidgets Forums

jQuery UI Widgets Forums Grid Get Data when onClick of button in Group Header

Tagged: , ,

This topic contains 2 replies, has 2 voices, and was last updated by  Gopre400 11 years, 4 months ago.

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

  • Gopre400
    Participant

    Hi I have placed a button in the group header on a grid. I would like to get data from the group field when I click on the button…

    source =
     {
           datatype: "xml",
           datafields: [
            	{ name: 'SignID' },
              { name: 'District' },
              { name: 'ActivityCode' },
              { name: 'SignQuantity', type: 'number'},
              { name: 'SignText' },
              { name: 'SignNote',  },
              { name: 'SignSize' },
              { name: 'RequestedBy' },
              { name: 'RequestedDate' },
              { name: 'RequestID' },
       ],
       async: false,
       record: 'Table',
       url: 'SRQWebService.asmx/GetSRQViewStreetPlatesGrid'
     };
     var dataAdapter = new $.jqx.dataAdapter(source, { contentType: 'application/json; charset=utf-8' });
     var groupsrenderer = function (text, group, expanded, data) {
     return'<div style="position: absolute;"><input type="button" value="Complete" data-icon="plus" data-mini="true"     id="btnAddSign"><span></span></div>';
    }
    $("#jqxgrid").jqxGrid(
          {
           width: '100%',
           source: dataAdapter,
           theme: 'darkblue',
           pageable: true,
           autoheight: true,
           sortable: true,
           altrows: true,
           enabletooltips: true,
           showstatusbar: true,
           editable: true,
           groupsrenderer: groupsrenderer,
           groupable: true,
           editmode: 'click',
          selectionmode: 'singlecell',
                            columns: [
                                { text: 'District', datafield: 'District', width: 100 },
                                { text: 'ActivityCode', datafield: 'ActivityCode', width: 100 },
                                { text: 'Quantity', datafield: 'SignQuantity', width: 100, align: 'right', cellsalign: 'right' },
                                { text: 'Text', datafield: 'SignText', width: 200 },
                                { text: 'Note', datafield: 'SignNote', width: 200 },
                                { text: 'Size', datafield: 'SignSize', width: 50 },
                                { text: 'Requested By', datafield: 'RequestedBy', width: 100 },
                                { text: 'Requested Date', datafield: 'RequestedDate', width: 150 },
                                { text: 'ID', datafield: 'RequestID', width: 50 },
                            ],
                             groups: ['RequestID']
                        });
                        }
    
                         $('#btnAddSign').click(function(rowid) { 
                            alert(rowid); 
                         }); 

    Peter Stoev
    Keymaster

    Hi Gopre400,

    That would not be possible due to the reason that Groups are rendered dynamically and your click handler is Static.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Gopre400
    Participant

    Is there a way to use the getgroup method to get data by clicking on the group header?

    How do I get the current group index?

    var group = $(‘#jqxgrid’).jqxGrid(‘getgroup’, ???);
    $(‘body’).data(‘requestid’, group.group);
    $(‘#popCompleteRequest’).popup(‘open’);

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

You must be logged in to reply to this topic.