表单提交后如何重新加载gridx/Grid



我如何才能再次调用JsonRest来瞄准我的URL并在表单提交发送后立即从服务器请求更新的Json ?请告诉我。由于

  var userStore = new JsonRest({target: "addUser/users", idProperty: "user_name"}),
     userColumns = [
      {id:'uuid', field: 'uuid', name: 'User UUID', width: 'auto'},
      {id:'user_name', field: 'user_name', name: 'UName', width: '7%'},
      {id:'first_name', field: 'first_name', name: 'FName', width: '0px'},
      {id:'last_name', field: 'last_name', name: 'LName', width: '0px'},
      {id:'start_date', field: 'start_date', name: 'Start', width: '0px'},
      {id:'end_date', field: 'end_date', name: 'End', width: '10%'},    
      {id:'subj_info', field: 'subj_info', name: 'Subject Info', width: 'auto'},
      {id:'issuer_info', field: 'issuer_info', name: 'Issuer Info',width: 'auto'},
      {id:'cert_fingerprint', field: 'cert_fingerprint', name: 'Cert Fingerprint', 
       width: 'auto'},
      {id:'action', field: 'action', name: '', width: '6%', widgetsInCell: true, 
      decorator: function(){
      return "<button data-dojo-type='dijit/form/Button' data-dojo-props= 
      iconClass:'dijitIconEdit' " + "data-dojo-attach-point='btn'>Update</button>";},
    // Widget Content
    myFormDialog2.show(); // Once widget is clicked display Dialog box with form data
    });}  };});}}],
              userGrid = new Grid({
              id: 'userGrid',
              cacheClass: Cache,
              store: userStore,
              structure: userColumns,
              modules: [Resizer, Sort, Pagination, Filter, Bar, "gridx/modules/CellWidget",
        "gridx/modules/Edit", "gridx/modules/select/Row", "gridx/modules/select/Cell",
              ]}, 'usersNode'); userGrid.startup();  });

**********************对话框,***************************************

<div data-dojo-type="dijit/Dialog" data-dojo-id="myFormDialog" title="Add User"
style="display: none">
    <form data-dojo-type="dijit/form/Form" id="myForm" encType="multipart/form-data" 
    action="addUser" method="post" target="uploadTrg">
        <p>First Name:
    <input data-dojo-type="dijit/form/TextBox" type="text" name="fname"size="30" /></p>
        <p>Last Name:
    <input data-dojo-type="dijit/form/TextBox" type="text" name="lname" size="30" /</p>
       <p>Upload Cert: 
        <input type="file" name="fileName" /></p>
        <div class="dijitDialogPaneActionBar">
     <button data-dojo-type="dijit/form/Button" type="submit" onclick="return 
   myFunction();">Add</button>
        <button data-dojo-type="dijit/form/Button" type="button" onclick="return 
   myFormDialog.hide();">Cancel</button>            
        </div></form></div>
  ******************************
  <script> function myFunction(){      
   alert("Form submitted!");
   myFormDialog.hide();      
   };
   </script>
  ******************************

你可以这样做:

function refresh_Grid(){
var store = new JsonRest({
target: "addUser/users"
});
myGrid=dijit.byId('userGrid');
myGrid.setStore(store);
}

然后在提交表单后调用这个函数。

在我的情况下,我使用dataGrid与ItemFileWriteStore,它适用于我。

相关内容

  • 没有找到相关文章

最新更新