EasyUI Forum

General Category => General Discussion => Topic started by: john17 on July 23, 2014, 11:14:16 PM



Title: clear all
Post by: john17 on July 23, 2014, 11:14:16 PM
hi guys,

how can I clear all the value when I click the add new row in datagrid every values in form and clear datagrid also?
Am having a trouble clearing the rows in datagrid here is my code

Code:
function newUser(){
           
            $('#dlg').dialog('open').dialog({
                title: 'New Vet',
                width: 1344,
                height: 635,
                closed: false,
                cache: false,
                modal: true,
                resizable: true
            });
           
            $('#fm').form('clear');
            $('#dg2').datagrid('reload');
           
            url1 = 'save-vet.html';
}

thank you very much


Title: Re: clear all
Post by: jarry on July 24, 2014, 01:27:46 AM
Call 'clear' method to clear the form values.
Code:
$('#fm').form('clear');

No 'clear' method exists in datagrid, but you can call 'loadData' method with empty data to clear the datagrid.
Code:
$('#dg').datagrid('loadData', []);


Title: Re: clear all
Post by: john17 on July 24, 2014, 10:07:44 PM
thanks for this jarry I appreciate it :D