EasyUI Forum
March 29, 2024, 05:01:46 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: How to handle onLoadSuccess if form load was used twice  (Read 7453 times)
karogel
Newbie
*
Posts: 28


View Profile
« on: November 02, 2016, 01:15:03 AM »

I have this code:
var flag;
function loanproposalshow(){
   var row = $('#dg_application_ci').datagrid('getSelected');
   if (row){
      // open dialog
      $('#dlg_application_proposal').dialog('open').dialog('setTitle','Loan Proposal');

      $('#fm_application_proposal').form('clear');
            
      var url_recom    = 'modules/data/get_loanrecom.php?id='+row.maker_id+'&loanappid='+row.app_loanappid;
      $('#fm_application_proposal').form('load',url_recom);

      $('#fm_application_proposal').form('load',row);
            
      $(function(){
         $('#fm_application_proposal').form({
            onLoadSuccess:function(){
               flag = true;
               calc_recom_apa();
            }
         });
      });
      url = 'modules/application/update_application.php?loanappid='+row.app_loanappid;
   }
}

I am having a problem in calling calc_recom_apa function. It should initiate after the 2 form load and not from the first "form('load',url_recom)"
Logged
battlezad
Newbie
*
Posts: 44


View Profile
« Reply #1 on: November 02, 2016, 05:43:16 AM »

var flag = false;

...

onLoadSuccess:function()
{
               if(flag) calc_recom_apa();
               flag = true;
}
Logged
karogel
Newbie
*
Posts: 28


View Profile
« Reply #2 on: November 03, 2016, 07:39:10 PM »


var url_recom    = 'modules/data/get_loanrecom.php?id='+row.maker_id+'&loanappid='+row.app_loanappid;
$('#fm_application_proposal').form('load',url_recom);

$('#fm_application_proposal').form('load',row);

is the above code OK? i am trying to load the data from "url_recom" and "row" data (from datagrid).

if i will use onLoadSuccess, will it fire after the first form(load ? or after the last form(load or is therea way to comine the 2 data source into single form(load
Logged
andyj
Jr. Member
**
Posts: 57



View Profile
« Reply #3 on: November 07, 2016, 03:01:25 AM »

If you are trying to combine data from two datasources into one datagrid or into one form, why don't you assemble your data using sql from your multiple datasources and combine it into a single json file?
Then load the data into your datagrid/form with distinct fields (some relating to datasource 1, some relating to datasource 2).
THen when you update/insert/delete, post the form variables to your controller, parse out the respective field values and do your CRUD operations to the 2 different tables/databases in your (Php) controller using the respective field values.

Does that make sense?
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!