EasyUI Forum
April 28, 2024, 01:58:11 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: last update data in datagrid edit dialog box (NOT SOLVED)  (Read 15368 times)
idirwantono
Newbie
*
Posts: 9


View Profile
« on: February 09, 2016, 08:16:23 AM »

dear all,
i opened 2 datagrid with different tab browser..i edited data in first datagrid...then i want to view the data in second datagrid with the same id key..but data cannot be change with last updated...how to keep data can be view with the last update..thank you
« Last Edit: February 09, 2016, 08:32:18 PM by idirwantono » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 09, 2016, 06:39:10 PM »

How do you edit and update a row? Please show an example to demonstrate your issue.
Logged
idirwantono
Newbie
*
Posts: 9


View Profile
« Reply #2 on: February 09, 2016, 07:35:15 PM »

help me all
Logged
idirwantono
Newbie
*
Posts: 9


View Profile
« Reply #3 on: February 09, 2016, 07:36:29 PM »

How do you edit and update a row? Please show an example to demonstrate your issue.

ok friend wait....i will capture my problem
Logged
idirwantono
Newbie
*
Posts: 9


View Profile
« Reply #4 on: February 09, 2016, 07:49:48 PM »

How do you edit and update a row? Please show an example to demonstrate your issue.

1. First i open 2 datagrid with different tab browser
datagrid scipt :
$(function() {
  var datanya = <?php echo json_encode($_POST); ?>;
  var type = '<?=$TANDA; ?>';
    $("#result").datagrid({
        //url : $.post('<?= site_url() ?>/tiket/searchResult/',datanya,'success'),
      url : '<?= site_url() ?>/masterp/searchResult/type/'+type,
       
        method : 'POST',
        queryParams: datanya,
        columns:[[
            {field:'KD_Cust',title:'KD_Cust',sortable:true},
            {field:'Nama_Cust',title:'Nama_Cust',sortable:true},
            {field:'Alamat',title:'Alamat',sortable:true},
            {field:'Telp',title:'Telp',sortable:true},
          {field:'CP',title:'CP',sortable:true},
            {field:'Nama_CustType',title:'Cust Type',sortable:true},

         
         {field:'IsAktif',title:'IsAktif',sortable:true,formatter:formatPrice}
         
        ]],
        toolbar:"#toolbard",
        pagination:"true",
        nowrap: "false",
        pageSize: 10,
        fitcolumns: "true",
        rownumbers: "false",
   width: "auto",
      height: "300",
   singleSelect: "true"
     
    })
});
2. Then i edited the data from first datagrid, example  before name field is AAAA, after edit is AAAABBBB
script edit
 function EDITDatas(){
         var row = $('#result').datagrid('getSelected');
         if (row){
            $('#dlgad').dialog('open').dialog('setTitle','Edit Data Employee');
            row.menumm="<?=$menunameid;?>";
            $('#fmad').form('load',row);
            url = '<?=site_url() ?>/masterp/editocustomerr/ID/'+row.Cust_ID;
         }
      }

script edit form
 <div id="dlgad" class="easyui-dialog" style="width:380px;height:auto;padding:10px 20px"
         closed="true" buttons="#dlgad-buttons" data-options="modal:true,iconCls:'icon-save',resizable:true,closable:false  ">
      <div class="ftitle">Data Customer</div>
      <form id="fmad" method="post" action="<?=site_url() ?>/masterp/editocustomerr/"  novalidate>

          <div class="fitem">
                <label>Kode_Cust</label>
                <input name="KD_Cust" id="KD_Cust"  style="width:200px;"  class="easyui-validatebox" required="true">

      
            </div>
         <div class="fitem">
                <label>Nama</label>
                <input name="Nama_Cust" id="Nama_Cust"  style="width:200px;" class="easyui-validatebox" required="true">
            <input name="menumm" id="menumm" type="hidden" value="<?=$menunameid;?>"/>
            
            
            </div>
      
         <div class="fitem">
                <label>Alamat</label>
                <input name="Alamat" id="Alamat"  style="width:200px;">
            </div>
         <div class="fitem">
                <label>phone</label>
                <input name="Telp" id="Telp"  style="width:200px;">
            </div>
         <div class="fitem">
                <label>CP</label>
                <input name="CP" id="CP"  style="width:200px;" >
            </div>
         
   <label id="resultzen"> 
         <div class="fitem">
                <label>Customer Type</label>
       
            <select name="m_CustType_ID" id="m_CustType_ID"  class="easyui-combobox" required="true"   >
                                                <?
foreach ($custipe as $resulejs) {
?>
         <option value="<?= $resulejs['CustType_ID']; ?>"><?= $resulejs['KD_CustType']; ?> -- <?= $resulejs['Nama_CustType']; ?></option>
         <?php
}
?>
       </select>    
         
            </div>
         </label>
         <div class="fitem">
                <label>IsAktif</label>
                <input type="checkbox" value="1" name="IsAktif" id="IsAktif" >
            </div>
      
      
      </form>
   </div>
   <div id="dlgad-buttons">
   <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveEmp()">Save</a>
      <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="
      $.messager.confirm('Confirm', 'Closed Without Saved?', function(r){
   if (r){
      javascript:$('#dlgad').dialog('close')
   }
});
      ">Close</a>
      <a href="#" class="easyui-linkbutton" iconCls="icon-undo" onclick="refreshdif()">Reload</a>
   </div>

3. I saved the data, then i want see the data from second datagrid with the same id key..but in the second datagrid the data not update, the value data in name field still AAAA, not AAAABBBB

Thank you
Logged
finzaiko
Newbie
*
Posts: 44


View Profile
« Reply #5 on: February 09, 2016, 09:40:59 PM »

Hello agan idirwantono, i try to nimbrung

have you check after your submit your data has already changed in your database, if yes just call reload after save $('#yourDatagridId').datagrid('reload'); if no make sure your data save changed you can check on your firebug post header
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #6 on: February 09, 2016, 10:11:22 PM »

i try to nimbrung too

try to console.log($("#result").datagrid('getRows')); in javascript console after updating data

and then see your javascript console in browser..and then find the row..check if it already updated or not..if not updated that mean your update code is failing/error
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
idirwantono
Newbie
*
Posts: 9


View Profile
« Reply #7 on: February 11, 2016, 08:47:04 PM »

i try to nimbrung too

try to console.log($("#result").datagrid('getRows')); in javascript console after updating data

and then see your javascript console in browser..and then find the row..check if it already updated or not..if not updated that mean your update code is failing/error

my fren aswzen,,
after updating the data in first datagrid, the results of the update can be seen in the first datarid...but if i see the second datagrid in different tab browser, data cannot be change with last updated..but if i reload the second datagrid...the data has been change with last updated...nah...
I'd like is I do not need to click the reload button to see the data changes. when I click the edit button then the edit form will appear that displays the most updated data, the data in the second DataGrid does not update not a problem.


Thank you with your answer and help me...ha ha ha
« Last Edit: February 11, 2016, 08:48:59 PM by idirwantono » Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #8 on: February 14, 2016, 07:50:12 PM »

you just put reload function after your updated succesfully commited
function saveEmp(){
  //your save code
  $('#yourDatagridId').datagrid('reload');
}
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
idirwantono
Newbie
*
Posts: 9


View Profile
« Reply #9 on: February 14, 2016, 10:13:23 PM »

you just put reload function after your updated succesfully commited
function saveEmp(){
  //your save code
  $('#yourDatagridId').datagrid('reload');
}


My Fren aswzen,

i have to tried to reload this datagrid after edit the data..n success in first datagrid..but datagrid in tab with different browser or datarid in different browser cannot be change...
or maybe my explanation is somewhat less so in this case..he2


so actually i opened two datagrid in the same time, but i opened with different browser..ok
Second step, i edited the data in first datagrid..edit success..and datagrid reload..( note : second datagrid cannot reload because second datagrid in different browser,,you can try if you opened google.com in two browser then you reload page in the first browser..certainly the browser that both are not automatically reload,,nah
well that's what I mean)

Okey. no problem..
but I would like when it opens in the second DataGrid with the same id key but with different browser..in the second datagrid data not update but when I click the edit button, a dialog box that contains the most updated data

   function saveEmp(){
         $('#fmad').form('submit',{
            url: url,
            onSubmit: function(){
               return $(this).form('validate');
            },
            success: function(result){
               var result = eval('('+result+')');
               if (result.success){
                  $.messager.show({   // show error message
                           title: 'Success',
                              //msg: result.errorMsg
                           msg: result.success
                        });
                  $('#dlgad').dialog('close');      // close the dialog
                  $('#result').datagrid('reload');   // reload the user data
               } else {
                  $.messager.show({
                     title: 'Error',
                     msg: result.msg
                  });
               }
            }
         });
      }
Logged
finzaiko
Newbie
*
Posts: 44


View Profile
« Reply #10 on: February 14, 2016, 11:14:22 PM »

try this
http://www.jeasyui.com/forum/index.php?topic=491.0
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #11 on: February 14, 2016, 11:29:28 PM »

obviously we cannot achieve that using easyUI..
please try auto refresh datagrid like mas finzaiko said above

or use the browser session
http://stackoverflow.com/questions/20219977/how-to-pass-a-value-from-a-parent-window-to-another-html-page-using-javascript
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
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!