hackolein / jquery-datatables-row-grouping

Automatically exported from code.google.com/p/jquery-datatables-row-grouping
0 stars 1 forks source link

Row grouping column not moving to new group #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using?
---------------------------------------------
* File:        jquery.dataTables.grouping.js
* Version:     1.0.
---------------------------------------------

I wasnt sure if I should post this here or in the DataTable forums.  If this 
should be moved please let me know.

I am having an issue with applying row grouping properly after changing the 
value of the category that I am grouping on.  In my case it is at RowIndex 5 
(modCName).  If I have an item in Cat1 and edit that row so that its now in 
Cat2 the values change properly in the table, but when I attempt to regroup the 
table with the following:

$('#my_table').dataTable().rowGrouping({ iGroupingColumnIndex: 5 });

It still thinks the row that I've edited is in Cat1.

Here is the structure of my dataTable:

var oTable = $("#my_table").dataTable({
    "bPaginate": true,
    "bLengthChange": false,
    "bFilter": false,
    "bSort": true,
    "bInfo": false,
    "bAutoWidth": false,
    "aoColumnDefs": [
                    { "bSortable": false, "aTargets": [0, 1] }
                ],
    "aoColumns": [
                    { "sClass": "modID", "bVisible": false },
                    { "sWidth": "5px" },
                    { "sClass": "modDate", "sTitle": "Date", "bVisible": false },
                    { "sClass": "modOdometer", "sTitle": "Odometer", "bVisible": false },
                    { "sClass": "modCID", "bVisible": false },
                    { "sClass": "modCName", "sTitle": "Category", "bVisible": false },
                    { "sClass": "modMID", "bVisible": false },
                    { "sClass": "modMName", "sTitle": "Manufacturer" },
                    { "sClass": "modVID", "bVisible": false },
                    { "sClass": "modVName", "bVisible": false },
                    { "sClass": "modPID", "bVisible": false },
                    { "sClass": "modPName", "sTitle": "Product" },
                    { "sClass": "modPPrice", "sTitle": "Cost" },
                    { "sClass": "modRating", "bVisible": false }
                ]
});

Here is the code that I am using to modify the values in the dataTable 
(toggleModCol is a separate function that Ive supplied the code below) :

toggleModCols(oTable, true);

var cNode = oTable.fnGetNodes(eNode);
$("#" + cNode.id + " " + ".modDate").html($("#txtModDate").val());
$("#" + cNode.id + " " + ".modOdometer").html($("#txtModOdometer").val());
$("#" + cNode.id + " " + ".modCID").html($("#txtModCategory").val());
$("#" + cNode.id + " " + ".modCName").html($("#txtModCategory 
option:selected").text());
$("#" + cNode.id + " " + ".modMID").html($("#txtModMID").val());
$("#" + cNode.id + " " + ".modMName").html($("#txtModManufacturer").val());
$("#" + cNode.id + " " + ".modVID").html($("#txtModVID").val());
$("#" + cNode.id + " " + ".modVName").html($("#txtModVender").val());
$("#" + cNode.id + " " + ".modPID").html($("#txtModPID").val());
$("#" + cNode.id + " " + ".modPName").html($("#txtModName").val());
$("#" + cNode.id + " " + ".modPPrice").html("$" + 
$("#txtModPrice").val().replace("$", ""));
$("#" + cNode.id + " " + ".modRating").html(0);

toggleModCols(oTable, false);

function toggleModCols(oTable, isVisible) {
    oTable.fnSetColumnVis(0, isVisible);
    oTable.fnSetColumnVis(2, isVisible);
    oTable.fnSetColumnVis(3, isVisible);
    oTable.fnSetColumnVis(4, isVisible);
    oTable.fnSetColumnVis(5, isVisible);
    oTable.fnSetColumnVis(6, isVisible);
    oTable.fnSetColumnVis(8, isVisible);
    oTable.fnSetColumnVis(9, isVisible);
    oTable.fnSetColumnVis(10, isVisible);
    oTable.fnSetColumnVis(13, isVisible);
}

If you need any further clarification or code please let me know and thank you 
in advance for taking the time to read over this.

Original issue reported on code.google.com by zo103...@gmail.com on 5 Jul 2011 at 6:44

GoogleCodeExporter commented 9 years ago
My whole thought was to grab nodes based on the classes instead of by the index 
so that if I added a new column to the table I wouldnt have to modify as much 
of the code.

I have caved in and decided to use the built in DataTable fnUpdate:

oTable.fnUpdate($("#txtModDate").val(), eNode, 2, true, false);
oTable.fnUpdate($("#txtModOdometer").val(), eNode, 3, true, false);
oTable.fnUpdate($("#txtModCategory").val(),eNode, 4, true, false);
oTable.fnUpdate($("#txtModCategory option:selected").text(),eNode, 5, true, 
false);
oTable.fnUpdate($("#txtModMID").val(),eNode, 6, true, false);
oTable.fnUpdate($("#txtModManufacturer").val(),eNode, 7, true, false);
oTable.fnUpdate($("#txtModVID").val(),eNode, 8, true, false);
oTable.fnUpdate($("#txtModVender").val(),eNode, 9, true, false);
oTable.fnUpdate($("#txtModPID").val(),eNode, 10, true, false);
oTable.fnUpdate($("#txtModName").val(),eNode, 11, true, false);
oTable.fnUpdate("$" + $("#txtModPrice").val().replace("$", ""),eNode, 12, true, 
false);
oTable.fnUpdate("0",eNode, 13, true, true);

Original comment by zo103...@gmail.com on 6 Jul 2011 at 2:53

GoogleCodeExporter commented 9 years ago
Could you send me HTML example or put this online so I can debug plugin wiht 
your code changes?

Original comment by vida.a...@gmail.com on 19 Aug 2011 at 10:04

GoogleCodeExporter commented 9 years ago
Hi, is there any change to send me online example or at least some zip archive 
with plain HTML/javascript do I can debug it here?

Thanks,
Jovan

Original comment by joc...@gmail.com on 24 Sep 2011 at 9:41

GoogleCodeExporter commented 9 years ago
I will try to get an example this week.  I will keep you posted.
On Sep 24, 2011 4:42 PM, <jquery-datatables-row-grouping@googlecode.com>
wrote:

Original comment by zo103...@gmail.com on 25 Sep 2011 at 2:38

GoogleCodeExporter commented 9 years ago
Jovan,

This week has just been extremely busy for me and I will be out of town over
the weekend.  Hopefully I can work on an example early next week.

Zach

Original comment by zo103...@gmail.com on 30 Sep 2011 at 5:59

GoogleCodeExporter commented 9 years ago
I will close this issue as there are no responses.

Original comment by joc...@gmail.com on 11 Feb 2012 at 11:02