EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Szoron on January 14, 2017, 12:56:10 PM



Title: subgrid in the subgrid
Post by: Szoron on January 14, 2017, 12:56:10 PM

Hi!
More would subgridet each other.
It happens to a query, of which more data is needed. Then, delving into them as well.
Ex .: listing a week of data daily. Then, delving into details of a selected day. Finally, a list of more data look it up.

the second subgrid does not open well.
Design of the main grid is not updated when sizing the internal grid.
The second element subgrid must be opened twice to place to be.


How do I update all of grid computing to avoid slipping in the picture?

thans for help!

Code:
function riport_ww_ip_address(){
  var date1 = $('#date1_ww_ip_address').datebox('getValue');
  var date2 = $('#date2_ww_ip_address').datebox('getValue');
  var contractor_id = $('#ww_contractors_list').combobox('getValue');
  var url_line;

  if (date1 === date2) { //egy nap lekérése
    if (contractor_id === -1) { // összes AV
      console.log('1dAllav');
      url_line = 'php/sql_riport_ww_ip_address.php?date1=' + date1 + '&date2=' + date2 + '&contractor_id=-1&mode=1dAllav';
    } else {
      url_line = 'php/sql_riport_ww_ip_address.php?date1=' + date1 + '&date2=' + date2 + '&contractor_id=' + contractor_id + '&mode=1d1av';
      console.log('1d1av');
    }
  } else { //több  nap
    if (contractor_id === -1) { // összes AV

    } else {

    }
  }
    $('#grid_ww_ip_address').datagrid({
      url: url_line,
      view: detailview,
      columns:[[
          {field:'tch_name',title:'Technikus',width:100},
          {field:'all_count',title:'Összcím',width:100},
          {field:'ready',title:'Elvégzett',width:100},
          {field:'ok_ready',title:'Sikeres',width:100},
          {field:'unfinished',title:'Megszakított',width:100}
      ]],
      detailFormatter:function(index,row){
        return '<div style="padding:2px"><table class="ddv"></table></div>';
      },
      onExpandRow: function(index,row){
        var index1 = index;
        var ddv = $(this).datagrid('getRowDetail',index1).find('table.ddv');
        if (date1 === date2) { //egy nap lekérése
          if (contractor_id === -1) { // összes AV
            url_line2 = 'php/sql_riport_ww_ip_address.php?date1=' + date1 + '&date2=' + date2 + '&contractor_id=-1&mode=1dAllav2';
          } else {
            url_line2= 'php/sql_riport_ww_ip_address.php?date1=' + date1 + '&date2=' + date2 + '&tch_id=' + row.tch_id + '&mode=1d1av2';
          }
        } else { //több  nap
          if (contractor_id === -1) { // összes AV

          } else {

          }
        };
        ddv.datagrid({
            url: url_line2,
            fitColumns:true,
            singleSelect:true,
            rownumbers:true,
            view: detailview,
            loadMsg:'',
            height:'auto',
            columns:[[
                {field:'ml_num',title:'Munkalapszám'},
                {field:'efi_id',title:'Ügyfélszám'},
                {field:'s',title:'Status'},
                {field:'efi_name',title:'Ügyfél név'},
                {field:'city',title:'Település'},
                {field:'zip',title:'Irányítószám'},
                {field:'efi_address',title:'Cím'},
                {field:'area',title:'Kosár'},
                {field:'type_name',title:'Munkatípus'},
                {field:'close_code_name',title:'Lezárókód'}
            ]],
            onResize:function(){
                $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
            },
            onLoadSuccess:function(){
                setTimeout(function(){
                    $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
                },0);
            },
            detailFormatter:function(index,row){
              return '<div style="padding:2px"><table class="ddv2"></table></div>';
            },
            onCollapseRow: function(index,row){
              console.log('collapserow');
              $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
              $('#ddv').datagrid('fixDetailRowHeight',index);

          },
            onExpandRow: function(index,row){
              var index2 = index;
              var ddv2 = $(this).datagrid('getRowDetail',index2).find('table.ddv2');
              if (date1 === date2) { //egy nap lekérése
                if (contractor_id === -1) { // összes AV
                  url_line3 = 'php/sql_riport_ww_ip_address.php?date1=' + date1 + '&date2=' + date2 + '&contractor_id=-1&mode=1dAllav3';
                } else {
                  url_line3 = 'php/sql_riport_ww_ip_address.php?date1=' + date1 + '&date2=' + date2 + '&address_id=' + row.aid + '&mode=1d1av3';
                }
              } else { //több  nap
                if (contractor_id === -1) { // összes AV

                } else {

                }
              };
              ddv2.datagrid({
                  url: url_line3,
                  fitColumns:true,
                  singleSelect:true,
                  rownumbers:true,
                  loadMsg:'',
                  height:'auto',
                  columns:[[
                      {field:'time_band',title:'Időablak'},
                      {field:'start',title:'Kezdés'},
                      {field:'end',title:'Befejezés'},
                      {field:'period',title:'Munkahossz'},
                      {field:'travel_time',title:'Útidő'},
                      {field:'node',title:'Node'},
                      {field:'skill_name',title:'Ismeret'},
                      {field:'job_code',title:'Munka kód'}
                  ]],
                  onResize:function(){
                      $('#ddv').datagrid('fixDetailRowHeight',index2);
                      $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
                      $('#ddv').datagrid('fixDetailRowHeight',index2);
                      $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
                      console.log('ddv2 resize');
                  },
                  onLoadSuccess:function(){
                    $('#ddv').datagrid('fixDetailRowHeight',index2);
                    $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
                    $('#ddv').datagrid('fixDetailRowHeight',index2);
                    $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
                  }
              });
              $('#ddv').datagrid('fixDetailRowHeight',index2);
              $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
              $('#ddv').datagrid('fixDetailRowHeight',index2);
              $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
          }
        });
        $('#grid_ww_ip_address').datagrid('fixDetailRowHeight',index1);
    }
    });
}

(http://www.kephost.com/images/2017/01/14/error.jpg)


Title: Re: subgrid in the subgrid
Post by: jarry on January 14, 2017, 04:58:05 PM
Please try to call the subgrid method instead.

http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=Nested%20SubGrid


Title: Re: subgrid in the subgrid
Post by: Szoron on January 15, 2017, 02:08:09 AM

Thank you, it has been found.
I mysql-out (php) directions are the data.
I know your example how to modify runtime parameters for the query?
How do I transfer one of the first grid paratméterét the subgrid query?

Thanks for the quick help.
The easyui very good


Title: Re: subgrid in the subgrid
Post by: jarry on January 16, 2017, 03:39:35 AM
The 'foreignField' property can be a function that return the request parameter values to retrieve child rows from server.
Code:
foreignField: function(prow){
return prow;
}