EasyUI Forum
May 15, 2024, 05:48:01 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datagrid functions  (Read 6863 times)
john17
Newbie
*
Posts: 17


View Profile Email
« on: July 23, 2014, 06:49:35 PM »

hi guys,

I just wanna ask a question

I have 6 function, add/edit/save for user and add/edit/save for clinic here's the code

Quote
for users

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');
           
            url1 = 'save-vet.html';
//........

function editUser(){
            var row = $('#dg').datagrid('getSelected');
            if (row){
               
                $('#dg2').datagrid({
                    url:'get-clinic.html?clinid='+row.system_md_id
                });
               
                $('#dlg').dialog('open').dialog({
                    title: 'Edit Vet',
                    width: 1344,
                    height: 635,
                    closed: false,
                    cache: false,
                    modal: true,
                    resizable: true
                });
               
                $('#fm').form('load',row);
               
                url1 = 'update-vet.html?id='+row.system_md_id;
//........


function saveUser(){
           
            $('#fm').form('submit',{
                url: url1,
                onSubmit: function(){
                    return $(this).form('validate');
                },
                success: function(result){
                    var result = eval('('+result+')');
                    if (result.errorMsg){
                        $.messager.show({
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    } else {
                        $('#dlg').dialog('close');        // close the dialog
                        $('#dg').datagrid('reload');    // reload the user data
                        $('#dg').datagrid('reload');    // reload the user data
                    }
                   
                }
            });
        }


Quote
for clinic

Code:
function newclinic(){
            $('#clinimain').dialog('open').dialog({
                    title: 'Add Clinic',
                    width: 500,
                    height: 500,
                    closed: false,
                    cache: false,
                    modal: true,
                    resizable: true,
                    closable: false
            });
           
            $('.clearinfo').val("");
           
            url2 = 'save-clinic.html';
        }
       
        function editclinic(id){
            var row = $('#dg2').datagrid('getSelected');
            if (row){
            $('#clinimain').dialog('open').dialog({
                    title: 'Edit Clinic',
                    width: 500,
                    height: 500,
                    closed: false,
                    cache: false,
                    modal: true,
                    resizable: true,
                    closable: false
            });

            $('#fm2').form('load',row);
               
            url2 = 'update-clinic.html?id='+row.system_company_clinic_id;
           
            }else{
                alert("Please Select A Record To Modify!");
            }
        }

function saveClinic(){
           
            $('#fm2').form('submit',{
                url: url2,
                onSubmit: function(){
                    return $(this).form('validate');
                },
                success: function(result){
                    var result = eval('('+result+')');
                    if (result.errorMsg){
                        $.messager.show({
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    } else {
                        $('#clinimain').dialog('close');        // close the dialog
                        $('#dg2').datagrid('reload');    // reload the user data
                        $('#dg2').datagrid('reload');    // reload the user data
                    }
                   
                }
            });
        }

Quote
My question is I change variable url in add/edit for each account into url1 for user and url2 for clinics , is it safe to change these variable?

thank you very much!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!