关于行内编辑的问题,如何实现修改了数据后,不向后台发请求? #50

Open
EaglePan opened this Issue Nov 21, 2016 · 2 comments

Projects

None yet

2 participants

@EaglePan

我想做的是等全部修改完后,一次提交。而不是没改一个提交一次。希望有大神可以帮我看看,谢谢了

@ssy341
Owner
ssy341 commented Nov 21, 2016

@EaglePan 你的行内编辑是怎么实现的?你得讲细节,贴上代码

@EaglePan
EaglePan commented Nov 21, 2016 edited

@ssy341 ,你好,这个是我的相关代码。

function getContactsTableInfo(){
	var editor = new $.fn.dataTable.Editor({
		
		ajax: function ( method, url, data, success, error ) {

		        $.ajax( {  
                    "url": ip+"/cust/getCont2",
   	             	"data": {
	   	                "pageNo": 1,
	   	                "pageSize":1
	   	              } ,  
	   	           "dataType": 'jsonp',
	               "jsonpCallback": "getCont2_p",
                    success: function (json) {  
                        success(json);
                    },  
                    error:function(x){
                    	console.log(x);
                    }
                } );
		},
        "processing": true,
        "serverSide": true,
        table: "#tb_contacts",
        fields: [
        	{label:'联系人',name:'SENDER'}
        ]
    });
	
    $('#tb_contacts').on('click', 'tbody td.editable', function (e) {
        editor.inline(this);
    });
    
	   var table=$('#tb_contacts').DataTable({
	        dom: 'Brtip',
	        ajax: {
	            "url": ip+"/cust/getCont",
	             "data": {
	                "pageNo": 1,
	                "pageSize":10
	              } , 
	            "dataType": 'jsonp' ,
	            "jsonpCallback":"getCont_p"
	        },
	        columns: [
	            {
	                data: null,
	                defaultContent: '',
	                className: 'select-checkbox',
	                orderable: false
	            },
	            {data:'SENDER', className: 'editable'}
	        ],
	        buttons: [
	        ] 
     }
	    });
	   
	   //获取选择对象
	    return table;
	}
@ssy341 ssy341 added the Editor label Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment