jquery jtable custom click event

对着背影说爱祢 提交于 2020-08-21 18:35:26

问题


I have implemented jtable of jquery. I want to perform some operation on row click and also want to put separate image and also want to add my own click event on that image.

I also want to pass that row's id to that custom event.

How can I add that to jquery table?

I tried some stuffs.

LoadGrid = (function () {
            //Prepare jtable plugin
            $('#GridTableContainer').jtable({
                title: 'Assets',
                paging: true,
                pageSize: 10,
                sorting: true,
                defaultSorting: 'ModelName ASC',
                actions: {
                    listAction: '/Adminsec/ManageAssets.aspx/List',
                    createAction: '/Adminsec/ManageAssets.aspx/CreateOrUpdate',
                    updateAction: '/Adminsec/ManageAssets.aspx/CreateOrUpdate',
                    deleteAction: '/Adminsec/ManageAssets.aspx/Deletes'
                },
                updateRecord: (function() { alert("my custom action.");
                }),
.......

回答1:


Finally, Done.

CustomAction: {
    title: '',
    width: '1%',
    sorting: false,
    create: false,
    edit: false,
    list: true,
    display: function (data) {
        if (data.record) {
            return '<button title="Edit Record" class="jtable-command-button jtable-edit-command-button" onclick="alert(' + data.record.TicketId + '); return false;"><span>Edit Record</span></button>';
        }
    }
}

Thanks.



来源:https://stackoverflow.com/questions/15600665/jquery-jtable-custom-click-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!