easyui中編輯單個儲存格,easyui編輯儲存格

來源:互聯網
上載者:User

easyui中編輯單個儲存格,easyui編輯儲存格

<pre name="code" class="javascript">    var currentfield = undefined;    var currentIndex = undefined; function onClickCell(rowIndex, field, value) {         if (field != undefined) {            if (currentIndex != undefined)            {   var ed = $('#grid').datagrid('getEditor', {index:currentIndex,field:currentfield});                var value=$(ed.target).datebox('getValue');                if(value&&value.length>0)                { if (!value.match(/^((((19|20)\d{2})-(0?(1|[3-9])|1[012])-(0?[1-9]|[12]\d|30))|(((19|20)\d{2})-(0?[13578]|1[02])-31)|(((19|20)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))-0?2-29))$/)) {                    $.messager.alert("提示", "時間格式有誤,資料復原!");                    $('#grid').datagrid('rejectChanges');                    coll = $('#grid').datagrid('getColumnOption', currentfield);                    coll.editor = null;                    currentIndex = undefined;                    currentfield = undefined;                    return;                }                }                $("#grid").datagrid('endEdit', currentIndex);                if (currentfield != undefined) {                    coll = $('#grid').datagrid('getColumnOption', currentfield);                    coll.editor = null;                }                var changes=$("#grid").datagrid("getChanges");                $('#grid').datagrid('acceptChanges');                var changedatas=JSON.stringify(changes);                $.ajax({                    type: 'post',                    dataType: 'json',                    data: {datas:changedatas},                    url: '/FundPurchasingManagement/PurchasingExecEntering/UpdatePurchaseTaskPlan',                    async: false,                    error: function (request) {                        alert("Connection?error");                    },                    success: function (data) {                        if(!data.success)                            $.messager.alert('溫馨提示', data.msg, 'info');                                          }                })            }            col = $('#grid').datagrid('getColumnOption', field);            col.editor = { type: 'datebox', options: { align: 'center'} };            $("#grid").datagrid('beginEdit', rowIndex);            currentIndex = rowIndex;            currentfield = field;        }        else {            currentIndex = undefined;            currentfield = undefined;        }           }



實現的效果為:

這是在datagrid中使用了datebox



怎編輯easyui datagrid 儲存格並儲存

acceptChanges
提交自從被載入以來或最後一次調用acceptChanges以來所有更改的資料。
text:'accept',iconCls:'icon-save',
handler:function(){
$('#tt').datagrid('acceptChanges');

}
 
easyui相同內容儲存格列不可以合并

多多看看api按照上面的指導例子做,能做出來,如果真的做不出來那就拼字串吧,把你想要的格式拼出來,就行了
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.