rize

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • in reply to: jqgrid drag and drop headings for grouping #102114
    rize
    Participant

    Hi ,

    I posted a similar Question on a different form and was pointed to a updated drag and drop heading source.

    This seems to solve my problems..

     

    Drag/Drop Grouping

     

    Thanks for the help.

    Ryan

    in reply to: jqgrid drag and drop headings for grouping #102111
    rize
    Participant

    Hi Tony,

    Thanks for the response.

    I was hoping someone else had this problem before and it had been solved already.

    here is my JS function to setup drag and drop headings.

    It works very well except for my heading name problem. 

    Please see the comments in the code for the problem I am facing.

    Thanks again for the help.

    Ryan

     

    function SetupDragAndDropHeader() {
    $(‘tr.ui-jqgrid-labels th div’).draggable({
    appendTo: ‘body’,
    helper: ‘clone’
    });

    $(‘#groups ol’).droppable({
    activeClass: ‘ui-state-default’,
    hoverClass: ‘ui-state-hover’,
    accept: ‘:not(.ui-sortable-helper)’,

    drop: function (event, ui) {
    var $this = $(this);
    $this.find(‘.placeholder’).remove();

    var groupingColumn = $(‘

  • ‘).attr(‘data-column’, ui.draggable.attr(‘id’).replace(‘jqgh_’ + gridId + ‘_’, ”));

    $(‘‘).click(function () {
    $(this).parent().remove();
    $(‘#’ + gridId).jqGrid(‘groupingRemove’);
    $(‘#’ + gridId).jqGrid(‘groupingGroupBy’, getheader());

    // !!!!!!!!!!!!!!!! tried adding here
    // setGroupHeaderText();

    if ($(‘#groups ol li:not(.placeholder)’).length === 0) {
    $(‘

  • Drag a column header and drop it here to group by that column
  • ‘).appendTo($this);
    }
    }).appendTo(groupingColumn);

     

    groupingColumn.append(ui.draggable.text());
    groupingColumn.appendTo($this);

    $(‘#’ + gridId).jqGrid(‘groupingRemove’);
    $(‘#’ + gridId).jqGrid(‘groupingGroupBy’, getheader());

    // !!!!!!!!!!!!!!!!  tried adding here

    //This almost works but it sets the first group Name only when you drag and drop a second group.
    // the second group then has no group heading name but data as the group name group ie {0}
    // adding a third group adds names for the first and second group but the third group has data

    //as the group name group ie {0}

    setGroupHeaderText();

    }

    }).sortable({
    items: ‘li:not(.placeholder)’,
    sort: function () {
    $(this).removeClass(‘ui-state-default’);
    },

    stop: function () {
    $(‘#’ + gridId).jqGrid(‘groupingRemove’);
    $(‘#’ + gridId).jqGrid(‘groupingGroupBy’, getheader());

    // !!!!!!!!!!!!!!!! tried adding here
    // setGroupHeaderText();

    }
    });
    }

    function getheader()
    {
    var header = $(‘#groups ol li:not(.placeholder)’).map(function () { return $(this).attr(‘data-column’); }).get();
    return header;
    }

    function setGroupHeaderText()
    {
    $(‘#’ + gridId).jqGrid(‘setGridParam’,
    {
    groupingView:
    {
    groupText: getheader(),

    // Future Problem

    // groupText: [getheader() + ‘ : {0} ‘],
    // on second column drag/drop it adds add heading to first group but it puts the names as

    //” Name,Price : John”

    // adding a third group changes the first heading to Name,Price,Location : John. The Second and third //group only has data as the group name i.e {0}

    groupSummaryPos: ,
    groupCollapse: true,
    ShowGroupColumn: true
    }
    });
    }

in reply to: Jqgrid Group Header Text displaying Sum #102098
rize
Participant

You are a life saver … this was driving me insane.

Works perfectly.

 

Thanks again.

Ryan

in reply to: Jqgrid Group Header Text displaying Sum #102095
rize
Participant

@Rekha said:
Hi,

This is regarding Jqgrid Group Header Text displaying Sum in the group Text.

I want the sum of a particular group displayed in the group header. I found this approach on the http://trirand.com/blog/jqgrid/jqgrid.html  demo site and it works. This issue is that, when I am trying to sum a currency, the group text  displays “3117.1499999999996”  The extra trailing decimals show up. But when I display on the group Summary, it displays fine as “3117.15”.

colModel: [ ……….

{ name: ‘Amount’, sortable: true, formatter: ‘currency’, align: “right”, sorttype: ‘currency’, decimalPlaces: ‘2’, summaryType: ‘sum’, defaultValue: ‘0.00’ }]

groupingView: {

                    groupField: ,

                    groupDataSorted: true,

                    groupText: ,

                    groupColumnShow: [true],

                    groupSummary: [true],

                    groupCollapse: true,

                    groupOrder: ,

                    showSummaryOnHide: false,

                },

Please help.

Thank s & Regards

Rekha

 

Hi,

I also have this exact problem , it does the same with number formatting as well not just currency. 

I have tried using a function to return the trimmed value but I don’t know how to pass the value {0} or {Amount}  into the function.

“ groupText: , ”   just passes  in the string

Does anyone know the fix or work around.

I am desperate.

 

Thanks

Ryan

Viewing 4 replies - 1 through 4 (of 4 total)

Stay connected with us in your favorite flavor!