nathfy / auto-table-to-chart

Automatically exported from code.google.com/p/auto-table-to-chart
0 stars 0 forks source link

ATTC and DataTable Conflicts #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Enable DataTables and ATTC on a Table
2.Click on Edit ATTC Chart Parameters
3.ATTC adds checkboxes on the top of header but when you click check box it 
actually sort the column as well to which is not the intended. We need to fix 
this issue.

Here is the test Page for this:

https://support.telcan.net/testing/jTest.asp

What is the expected output? What do you see instead?

When you click check box, it should not trigger sorting.

What version of the product are you using? On what browser/OS?

Latest versions.

Original issue reported on code.google.com by tahir.ah...@callture.com on 16 Aug 2013 at 10:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Looks like the Click event on the checkbox needs to be stopped from bubbling 
up. Looking at the code, if you amend the js function for the click on around 
line 371 to add the event and to event.stopPropagation() at the end:

appendEl=$(appendEl).on("click", function(event){
                                    //give this col an id if it doesn't have one
                                    var myId='attcCol'+$(this).val();
                                    if($(this).parents('th').attr('id')!= undefined){
                                        myId=$(this).parents('th').attr('id');
                                    }else{
                                        $(this).parents('th').attr('id',myId);
                                    }
                                    //change the attribute to this column
                                    if($(this).attr('data-attc-colType')=='desc'){
                                        tableEl.attr('data-attc-colDescription',myId);
                                    }else{
                                        //todo remove value if unchecked
                                        if(tableEl.attr('data-attc-type') =='pie'){
                                            tableEl.attr('data-attc-colValues',myId);
                                        }else{
                                            //select all the checked inputs
                                            var checkedIds=tableEl.find('input[data-attc-colType=value]:checked').parents('th').map(function() { return this.id; }).get().toString();
                                            tableEl.attr('data-attc-colValues',checkedIds);
                                        }
                                    }
                                    //re-create chart
                                    CreateChart(tableEl.attr('data-attc-type'),settings.location,tableEl,defaultHeight);
                                    event.stopPropagation();
                                }); 

Original comment by nat...@gmail.com on 17 Jul 2014 at 9:00