| 
							Berzy
							
						 | 
						
							
								  | 
								
									
									 «  on: July 22, 2014, 09:01:58 AM »  | 
								
								 | 
							  
							 
							Again fighting with filters...
  I have a master-detail situation
  datgrid + filters, acting as detail.
  On load I have the filters working, but when I use the mater table (selectin an ID) the filters gone. Below some code, in red the call that reset my grid:
  MASTER:
      <table id="icomm" class="easyui-datagrid"            url="~/IncomingOwnerMail/DataLoaderComm"            pagination="false" fitcolumns="false"            singleselect="true" striped="true"></table>
  DETAIL:
   <table id="iom" class="easyui-datagrid"            url="~/IncomingOwnerMail/DataLoader"            pagination="true" fitcolumns="false"            singleselect="true" pagesize="20" striped="true" fit="true"            toolbar="#tiom"></table>
  +Javascript definition:
        $(document).ready(function () {             var grid = $('#iom');
              grid.datagrid({                 columns: [[                 {                     field: 'stato', title: '@LabelMapping.Value("PRT_sel_stato", (User as LPEUser).Language)', width: 80, align: 'right', sortable: true                 },                 {                     field: 'PROTOCOLLO', title: '@LabelMapping.Value("PRT_sel_PROTOCOLLO", (User as LPEUser).Language)', width: 80, align: 'right', sortable: true                 },                 {                     field: 'PRT_EST', title: '@LabelMapping.Value("PRT_sel_PRT_EST", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'MITTENTE', title: '@LabelMapping.Value("PRT_sel_MITTENTE", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'DATA_PRT', title: '@LabelMapping.Value("PRT_sel_DATA_PRT", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'commessa', title: '@LabelMapping.Value("PRT_sel_commessa", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'Ente_Risposta', title: '@LabelMapping.Value("PRT_sel_Ente_Risposta", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'Subject', title: '@LabelMapping.Value("PRT_sel_Subject", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'PRT_risposta', title: '@LabelMapping.Value("PRT_sel_PRT_risposta", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'Data_risposta', title: '@LabelMapping.Value("PRT_sel_Data_risposta", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 },                 {                     field: 'tempo_risposta', title: '@LabelMapping.Value("PRT_sel_tempo_risposta", (User as LPEUser).Language)', width: 100, align: 'right', sortable: true                 }                 ]],                 onLoadError: function (value) {                     $.messager.alert('Warning', value.status);                 },                 onDblClickRow: function (rowIndex, rowData) {                     dettagliProtocollo();                 },                 remoteFilter: true             });
              grid.datagrid({                 rowStyler: function (index, row) {                     if (row.stato == 'delay ') {                         return 'color:red;'                     }                     else if (row.stato == 'completed ') {                         return 'color:green;'                     }                 }             });
              grid.datagrid('enableFilter', [             {                 field: 'stato',                 type: 'text',                 options: { precision: 0 },                 op: ['contains', 'equal', 'notequal']             },              {                  field: 'PROTOCOLLO',                  type: 'numberbox',                  options: { precision: 0 },                  op: ['equal', 'notequal', 'less', 'greater']              },              {                  field: 'PRT_EST',                  type: 'text',                  options: {},                  op: ['contains', 'equal', 'notequal']              },              {                  field: 'MITTENTE',                  type: 'text',                  options: {},                  op: ['contains', 'equal', 'notequal']              },              {                  field: 'DATA_PRT',                  type: 'datebox',                  options: {                      formatter: function (aDate) {                          var y = aDate.getFullYear();                          var m = aDate.getMonth() + 1;                          var d = aDate.getDate();                          return d + '-' + m + '-' + y;                      },                      parser: function (s) {                          if (s != '') {                              var ddd = s.split("-");                              return new Date(ddd[2], ddd[1] - 1, ddd[0])                          }                          return new Date();                      }                  },                  op: ['equal', 'notequal', 'less', 'greater']              },             {                 field: 'commessa',                 type: 'text',                 options: { precision: 0 },                 op: ['contains', 'equal', 'notequal']             },             {                 field: 'Ente_Risposta',                 type: 'text',                 options: { precision: 0 },                 op: ['contains', 'equal', 'notequal']             },             {                 field: 'Subject',                 type: 'text',                 options: { precision: 0 },                 op: ['contains', 'equal', 'notequal']             },             {                 field: 'PRT_risposta',                 type: 'text',                 options: { precision: 0 },                 op: ['contains', 'equal', 'notequal']             },              {                  field: 'Data_risposta',                  type: 'datebox',                  options: {                      formatter: function (aDate) {                          var y = aDate.getFullYear();                          var m = aDate.getMonth() + 1;                          var d = aDate.getDate();                          return d + '-' + m + '-' + y;                      },                      parser: function (s) {                          if (s != '') {                              var ddd = s.split("-");                              return new Date(ddd[2], ddd[1] - 1, ddd[0])                          }                          return new Date();                      }                  },                  op: ['equal', 'notequal', 'less', 'greater']              },              {                  field: 'tempo_risposta',                  type: 'numberbox',                  options: { precision: 0 },                  op: ['equal', 'notequal', 'less', 'greater']              }             ]);
              /*************************************************************/             /* GRIGLIA COMMESSE **********************************************/
              var grid = $('#icomm');
              grid.datagrid({                 columns: [[                 {                     field: 'commessa', title: '@LabelMapping.Value("PRT_sel_commessa", (User as LPEUser).Language)', align: 'right', sortable: true                 }                 ]],                 onLoadError: function (value) {                     $.messager.alert('Warning', value.status);                 },                 onClickRow: function (rowIndex, rowData) {                     $('#ienti').datagrid({                         url: '@Url.Action("DataLoaderEnti", "IncomingOwnerMail")' + '?commessaId=' + rowData.commessa                     });     $('#iom').datagrid({                         url: '@Url.Action("DataLoader", "IncomingOwnerMail")' + '?commessa=' + rowData.commessa + "&enteId="                     });
                      $.getJSON('@Url.Content("~/IncomingOwnerMail/DataLoaderNoResponseTotal")', { "commessaId": rowData.commessa }, function (data) {
                          $('#NoResponseTotal').html(data.Text);                     });
                      $.getJSON('@Url.Content("~/IncomingOwnerMail/DataLoaderNoProcessedTotal")', { "commessaId": rowData.commessa }, function (data) {
                          $('#NoProcessedTotal').html(data.Text);                     });                 }             });
 
  
						 |