JQuery Jtable Change position of Add/Edit button

150 views Asked by At

Is there any way to change the position of jquery jtable edit or delete button? They appear at the last columns of the row i.e at the right most end. Is there any way to bring them in the left i.e. at the beginning of the row?

1

There are 1 answers

0
hardika On

You can add custom icons anywhere you want

fields: {
            Name: {
                title: 'Name'
            },
            Email: {
                title: 'Email',
                key: true,
                list: true,
                display: function (data) {  // display text with Icon
                    var delete_icon = document.createElement('a');
                    delete_icon.className = 'btn'
                    delete_icon.setAttribute('href', '#');
                    delete_icon.setAttribute(
                       'onClick', 'YourFunctionName(' + your paramters+ ');'
                     );
                     return $(data.records.Email + '--'+ delete_icon);
                }
            },
            'DeleteIcon': {
                width: '1%',
                sorting: false,
                display: function(data) {
                        if (data.record) {
                            var delete_icon = document.createElement('a');
                            delete_icon.className = 'btn'
                            delete_icon.setAttribute('href', '#');
                            delete_icon.setAttribute(
                                'onClick', 'YourFunctionName(' + your paramters+ ');'
                            );
                            return $(delete_icon);
                        }
                }
            },
        },