duanmo5724 2015-02-26 10:43
浏览 45

如何在使用自定义代码创建/编辑/删除按钮并更新表格行 - 前卫模板时关闭“编辑器”窗口

I am using the PHP template from Avant (http://avant.redteamux.com/tables-editable.php) to create an Editable Table where you select a row in the table and when you click on the Edit button, a popup window appears with the fields from this row. I am trying to add backend code for this that calls a web service to update the database. The stage I am at is, on clicking the Edit button, the popup window appears as expected, I can edit the fields and the call to the web service is successfull. My main issue is how to close the popup window after that and have the updates reflected in the table. My code is:

// editor is successfully initialized with jsondata
var table = $('#editable').dataTable({
    "sDom":"<'row'<'col-sm-6'T><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col-sm-6'p>>",
    "aaData":jsondata,
    "bServerSide": false,
    "bAutoWidth": false,
    "bDestroy": true,
    "aoColumns":columnsjson,
    "oTableTools":{
        "sRowSelect":"multi",
        "aButtons":[
            { sExtends:"editor_create", editor:editor },
            { sExtends:"editor_edit", editor:editor, 
                "formButtons": [
                                {
                                    label: "Update",
                                    className: "btn-primary btn",
                                    fn: function (e) {
                                        // Code to call the service: this is successfull
                                        // This is what I need to figure out, I've tried: editor.submit(); | $(this).close(); 
                                            // (I tried several alternates for "this")
                                    }
                                }
                            ]
            },
            { sExtends: "editor_remove", editor: editor  }
});

Thanks.

  • 写回答

1条回答 默认 最新

  • duanchen6423 2015-10-20 12:17
    关注

    So it turned out quite simple actually. This is the statement for it: editor.close();

    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)