EasyUI Forum
April 23, 2024, 01:32:24 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: Datagrid enableFilter - isn't working operators menu and filtering ...  (Read 16605 times)
Rimokas
Newbie
*
Posts: 12


View Profile Email
« on: August 25, 2015, 02:52:53 AM »

Hi,

trying to do filtering on the grid. If to let only 'enableFilter', without fields array parameters - all is working OK . But it to try add field array - filter operator button isn't working ( no menu show clicking on filter image ) and filtering on this fields isn't working too ( no command of filtering to remote url ) . What that can be wrong ?

Code:
    dg.datagrid( 'enableFilter', 
         [
            {
               field: 'uzs_kiekis',
               type : 'numberbox',
               options: { precision: 0 },
               op   : ['equal','notequal','less','greater']
            }
         ])


Filtering with remote server , datagrid options :

            view         : scrollview,
            striped      : true,
            pagination   : false,
            pageSize     : this.pusl_dyd,
            singleSelect : false,
            autoRowHeight: false,
            remoteFilter : true,
            remoteSort   : true,
            multiSort    : true,

Also datagrid is with datagrid-cellediting.js plugin ...

Thanks in advance ...
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: August 25, 2015, 06:14:49 AM »

Please refer to this example http://jsfiddle.net/6u2b8pyp/
Logged
Rimokas
Newbie
*
Posts: 12


View Profile Email
« Reply #2 on: August 25, 2015, 06:42:20 AM »

Thank you, found the reason of problem ... I rendered datagrid to 'body' and that was while filter wasn't not working ... Added to body table element  - works fine ...  Wink
Logged
Rimokas
Newbie
*
Posts: 12


View Profile Email
« Reply #3 on: August 25, 2015, 08:40:30 AM »

Another problem with filter .

I'm trying with remote database and datagrid is with 3 plugins :

Code:
  <script src="jeasy/jquery.min.js"></script>
   <script src="jeasy/jquery.easyui.min.js"></script>
   <script src="jeasy/datagrid-filter.js"></script>
   <script src="jeasy/datagrid-scrollview.js"></script>
   <script src="jeasy/datagrid-cellediting.js"></scrip>
   <script id="script-lang" src="jeasy/locale/easyui-lang-lt.js"></script>
<script src="jsf/func.js"></script>
   <script src="jsf/grd.js"></script>

I alreday asked , how to disable cellediting in one click. It's working OK. But now I'm trying to do filtering with text field withouts operations after cell editing ( also tried and with other filters - the same ) ... Begining typing I'm seeing that again open editor on just edited cell and mine keyword is going here , not in filter text ...
It seems that mine update solution isn't fully functional .. Please , correct me , what I must to do. I'm using only 'onAfterEditing' event :

Code:

      this.create_grid = function() // "this" here - created own object storing info about grid columns and own parameters ...
      {
         var obj = this;
         var ret =
         {   
            fit        : true,
            idField    : this.pagr_rakt,
            columns    : [ this.grid_stulp ],
            toolbar    : [
            {
               id     : 'naujas',
               text   : 'Naujas',
               iconCls: "icon-add",
               plain  : true,
               handler: function(){ $.messager.alert( "naujas" ); } //$( '#dg' ).datagrid( 'addRow' ) }
            },
            {
               id     : 'salint',
               text   : 'Šalinti',
               iconCls: "icon-remove",
               plain  : true,
               handler: function(){ $.messager.alert( "salinti" ); }
            },
            {
               id     : 'saugot',
               text   : 'Išsaugoti',
               iconCls: "icon-save",
               plain  : true,
               handler: function(){ $.messager.alert( "issaugoti" ); }
            },
            {
               id     : 'atmesti',
               text   : 'Atmesti',
               iconCls: "icon-undo",
               plain  : true,
               handler: function(){ $.messager.alert( "atmesti" ); }
            }],
            view          : scrollview,
            striped       : true,
            pagination    : false,
            pageSize      : this.pusl_dyd,
            singleSelect  : false,
            autoRowHeight : false,
            remoteFilter  : true,
            remoteSort    : true,
            multiSort     : true,
            clickToEdit   : false,
            dblclickToEdit: true ,
            url           : format_url( this, "get" ),
            onAfterEdit   : function( index, row, changes )
            {
                //row.editing = false;
                cell_update( index, row, changes, obj, this );
            }
         }   
         return ret;
      }


function cell_update:

Code:
function cell_update( index, row, changes, obj, dg )
{
   var laukai = Object.keys( changes );
   var laukas = laukai[ 0 ];
   var reiksm = changes[ laukas ];
   var snd    = "phpf/" + obj.grid_url + "?tbl=" + obj.pagr_lent + "&idf=" + obj.pagr_rakt + "&idk=" + row[ obj.pagr_rakt ] + "&cmd=upd&lks=" + laukas + "&var=" + reiksm +
   "&fld=" + obj.lauku_eil + ( obj.rysio_eil ? "&jon=" + obj.rysio_eil : "" ); // update query to php ...
   
   var ret = ajax_get( snd );
   if ( ret.status != 'success' )
      alert( ret.message );
   else
   {
      var upd = 0; // check if other related field updated or not
      var rec = ret.rows;
      for ( var u in obj.grid_stulp )
      {
         var lks = obj.grid_stulp[ u ].field;
         if ( rec[ 0 ][ lks ] != row[ lks ] )
         {
            row[ lks ] = rec[ 0 ][ lks ];
            upd ++;
         }
      }
      if ( upd > 0 ) // if returned record differs from existing row - update
         dg.datagrid( 'updateRow', { index: index, row: row } );
   }
}

It seems that this cell update is related to typing for filters ...

Another question - exist possibility to translate filter menu operations ? ( equal, contains ... )

Many thanks in advance ...



Logged
bvn
Newbie
*
Posts: 13


View Profile
« Reply #4 on: October 24, 2016, 05:53:19 PM »

Is there documentation on 'enableFilter' and other filter related datagrid options?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #5 on: October 24, 2016, 08:36:09 PM »

Please look at this documentation http://www.jeasyui.com/extension/datagrid_filter.php
Logged
bvn
Newbie
*
Posts: 13


View Profile
« Reply #6 on: October 25, 2016, 11:03:08 AM »

Thank you... I've missed extension part of the site Smiley
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!