简体   繁体   English

jquery jtable 自定义点击事件

[英]jquery jtable custom click event

I have implemented jtable of jquery.我已经实现了 jquery 的 jtable。 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.我还想将该行的 id 传递给该自定义事件。

How can I add that to jquery table?如何将其添加到 jquery 表中?

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.");
                }),
.......

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.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM