Answers for "dataTables treeGrid js"

0

dataTables treeGrid js

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': './arrays.txt',
    'treeGrid': {
        'left': 10,
        'expandIcon': '<span>+</span>',
        'collapseIcon': '<span>-</span>'
    }
});
Posted by: Guest on June-22-2021

Browse Popular Code Answers by Language