Code Monkey home page Code Monkey logo

datatables.treegrid.js's People

Contributors

ennerperez avatar homfen avatar mdimaas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datatables.treegrid.js's Issues

expose events

Can we expose some events so that we can do some manipulation when item is shown or hidden? Thanks.

error mark rows as selected on expand row

After expand row in dataTable mark as selected more then one row

Source row 117 is :
select && (selectedIndexes = dataTable.rows({selected: true}).indexes().toArray());

Check for variable:
dataTable.rows({selected: true}).indexes().toArray();
Console: (2) [0, 1]

dataTable.rows(".selected").indexes().toArray();
Console: [1]

Docs

It is not obvious how to use this plugin. Can you please make documentation more detailed? How to make items children? How to create tree-levels?

click child only creates append

click on the td of the second level does not obey the collapsed and expanded (red circle), in the second level, clicking on td only to create append of the children.

issue griddatatables

Collapse all nodes

Hello,

is there a function/property for collapse all childs into the datatable?
Thank you

Best regards, Luca

Children

Can we have an option to use a different word other than children? Sometimes we don't have complete control of the data so we can't name the child dataset 'children'. Having an option to name it something else would help. Thanks.

some bugs

  1. for child rows not called callback function of dataTable "fnRowCallback"

  2. after expand parent row attribute "id" changed to id="tr-1549374473989"

  3. for file version 1.0.1 not fixed TreeGrid.version = '1.0.0';

'children' of undefined

Hi,

I use datatables with ajax and server side, but when I click on expand, I get an error

Uncaught TypeError: Cannot read property 'children' of undefined

bower install

Hi,

Can you add an installation via bower, it will be great.

Best regards.

TypeError: data is undefined

Hi,
I am trying to reproduce the example that you given.
I have this code :
`

<script type="text/javascript" src='{{ asset('js/DataTables/media/js/jquery.js') }}'></script>

<script type="text/javascript" src='{{ asset('js/DataTables/media/js/jquery.dataTables.min.js') }}'></script>

<script type="text/javascript" src='{{ asset('js/dataTables.treeGrid/dataTables.treeGrid.js') }}'></script>

<script>
    var columns = [
        {
            title: '',
            target: 0,
            className: 'treegrid-control',
            data: function (item) {
                if (item.children) {
                    return '<span>+</span>';
                }
                return '';
            }
        },
        {
            title: 'Name',
            target: 1,
            data: function (item) {
                return item.name;
            }
        },
        {
            title: 'Position',
            target: 2,
            data: function (item) {
                return item.position;
            }
        },
        {
            title: 'Office',
            target: 3,
            data: function (item) {
                return item.office;
            }
        },
        {
            title: 'Extn.',
            target: 4,
            data: function (item) {
                return item.extn;
            }
        },
        {
            title: 'Start date',
            target: 5,
            data: function (item) {
                return item.start;
            }
        },
        {
            title: 'Salary',
            target: 6,
            data: function (item) {
                return item.salary;
            }
        }
    ];

    $('#example').DataTable({
        'columns': columns,
        'ajax': "{{ asset('js/arrays.json') }}",
        'treeGrid': {
            'left': 10,
            'expandIcon': '<span>+</span>',
            'collapseIcon': '<span>-</span>'
        }
    });
</script>

`

And my file arrays.json contains is ine the same format of your example.

So in my dispplay I have that :
image

My problem is, when I click on "+" or "-" I have this message in my console :
image

" [Afficher/Masquer les détails du message.] TypeError: data is undefined[En savoir plus] dataTables.treeGrid.js:140:1
fnConstruct/<
http://localhost/gestion_MKT/web/js/dataTables.treeGrid/dataTables.treeGrid.js:140:1
dispatch
http://localhost/gestion_MKT/web/js/DataTables/media/js/jquery.js:3:12392
add/r.handle
http://localhost/gestion_MKT/web/js/DataTables/media/js/jquery.js:3:9156
"

I hope you cna help me to understand why it doesn't work.

Thank you.

Can have unmatched child dataset?

In your example, your parent data matches up with child data in terms of the title. How would one go about having a different dataset as the child? Something that looks like this:

Nation
+ France
+ Germany
+ United States
            States        Population
            Alabama       1000000
            Alaska        1000000

Would be nice even without the header, just display the data or the header could be on top next to "Nation"

ServerSide data

How to get this to work with server side data? I have table that may go about 1000 parents and 5000 rows in all. I don't want to load full data set into DT during initialization.

Load 'Children' by ajax

Hi,

I use datatables with ajax and server side, Can I get children data by ajax when I click on expand ?
thanks.

Collapse on level n-1

Hi,

When there are 3 levels, and you collapsed the level n-1, the n+1 items are not deleted ...

image

image

Can you help me ?

Regards
Frédérik

当多层数据时,第一个子集没有子集,第二个子集有子集时,在子集都展开的情况下点击父级收缩会出现死循环

{
"data": [
{
"name": "Tiger Nixon",
"position": "System Architect",
"office": "Edinburgh",
"extn": "5421",
"start": "2011/04/25",
"salary": "$320,800",
"children": [
{
"name": "Shad Decker",
"position": "Regional Director",
"office": "Edinburgh",
"extn": "6373",
"start": "2008/11/13",
"salary": "$183,000"
},
{
"name": "Lael Greer",
"position": "Systems Administrator",
"office": "London",
"extn": "6733",
"start": "2009/02/27",
"salary": "$103,500",
"children": [
{
"name": "Shad Decker",
"position": "Regional Director",
"office": "Edinburgh",
"extn": "6373",
"start": "2008/11/13",
"salary": "$183,000"
},
{
"name": "Jonas Alexander",
"position": "Developer",
"office": "San Francisco",
"extn": "8196",
"start": "2010/07/14",
"salary": "$86,500",
"children":[
{
"name": "Shad Decker",
"position": "Regional Director",
"office": "Edinburgh",
"extn": "6373",
"start": "2008/11/13",
"salary": "$183,000",
"children":[
{
"name": "Shad Decker",
"position": "Regional Director",
"office": "Edinburgh",
"extn": "6373",
"start": "2008/11/13",
"salary": "$183,000"
}

                        		]
               				 }
	                       
                	]
                    }
                    
                ]
            }
        ]
    }
]

}

TreeGrid v1.0.0 does not work with DataTables v.1.10.19

rows do not expand as plus/minus buttons are clicked.
I traced the code on browser debugger and I was able to fix it as below:
// Expand TreeGrid
dataTable.on('click', 'td.treegrid-control', function (e) {
if (!$(this).html()) {
return;
}
var tr = $(this).closest('tr[role="row"]');

        // record selected indexes
        var selectedIndexes = [];
        select && (selectedIndexes = dataTable.rows({selected:true}).indexes().toArray());
        var tr = $(this).closest('tr[role="row"]'); //ADD THIS LINE
        var row = dataTable.row(tr); //CHANGE THIS LINE FROM var row = dataTable.row(this); //"this" selects the cell, not the row!!!
        var index = row.index();
        var data = row.data();

Sort on children column

Hi,

First of all, TreeGrid is a POWERFUL datatable plugin with a simple approach (children)
There is however a small lack for me. When a column is sorted, the column of the child branch is not sorted.
If that had been possible, it would be great !

Best
Frédérik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.