Page 40 of 92 FirstFirst ... 3038394041425090 ... LastLast
Results 391 to 400 of 914

Thread: Grid Filter (Plugin)

  1. #391
    Sencha User
    Join Date
    Aug 2007
    Posts
    64

    Default

    @highmemory : if you can transform your record dataset before sending it to ext, i think the better solution is to define this field as a boolean.

  2. #392

    Default

    Quote Originally Posted by cocorossello View Post
    Hi,

    I have another kind of filters, if anyone is interested. At the moment, they only work for 'remote' grids, and the idea is more limited as you can't do all kinds of filters, but you can do text searches or combos or date (whatever kind of ext field).

    The idea is that the filter is always visible and is in the column model...


    cocorossello, this is fantastic and exactly what I've been looking for! Have you improved it at all since you last talked about it?

    Has anyone done any work to render filters in a style like this, but have more of the power and features of the filtering as in the main plugin that this thread is about?

    If not, I'm going to be working on it...

    I think the ability to show the filters directly under each column header is a much easier and simpler model for typical end users to grasp... it may not be quite as powerful, but it's more accessible, simpler and easier to use.

  3. #393
    Sencha User
    Join Date
    Mar 2008
    Posts
    50

    Default

    hello.
    when i pass the filter parameter to php with multifiltering i get only filter[0][... in the foreach loop?
    please can you advice me on how to get the rest filter[1][... filter[2][...etc
    any suggestion appreciated...
    thanx in advance!

  4. #394
    Sencha User
    Join Date
    Jul 2007
    Location
    Moscow, Russia
    Posts
    295

    Default

    reminder
    I'm posting my filter function some pages ago...you can use it.

  5. #395
    Sencha User
    Join Date
    Mar 2008
    Posts
    50

    Default

    Quote Originally Posted by 6epcepk View Post
    Ok, no problems

    I have write function wich creates SQL query. Works fine with string, numeric and date column types.
    Functions:
    PHP Code:
    // ==================================================
    //            FUNCTION - BUILD FILTER QUERY
    // ==================================================
    function get_filter($data$alias false$glue 'AND') {

        
    $condition '';
        
        
    $comparison = array('gt' => '>''lt' => '<''eq' => '=');
        
        foreach (
    $data as $el) {
        
            if (
    $el['data']['type'] === 'string') {
            
                
    $condition .= get_filter_alias($el['field'], $alias) . $el['field'] . ' LIKE \'%' $el['data']['value'] . '%\' ' $glue ' ';
            
            } elseif (
    $el['data']['type'] === 'numeric') {
            
                
    $condition .= get_filter_alias($el['field'], $alias) . $el['field'] . ' ' $comparison[$el['data']['comparison']] . ' ' $el['data']['value'] . ' ' $glue ' ';
            
            } elseif (
    $el['data']['type'] === 'date') {
            
                
    $timestamp strtotime($el['data']['value']);
                
    $condition .= get_filter_alias($el['field'], $alias) . $el['field'] . ' ' $comparison[$el['data']['comparison']] . ' ' $timestamp ' ' $glue ' ';
            
            }
            
        }
        
        
    $condition = (!empty($condition)) ? 'WHERE ' $condition '';
        
        return 
    rtrim($condition' ' $glue ' ');

    }


    // ==================================================
    //            FUNCTION - GET FIELD ALIAS
    // ==================================================
    function get_filter_alias($field$alias) {

        
        if (!empty(
    $alias) && !is_array($alias)) {
        
            return 
    $alias '.';
            
        } elseif (!empty(
    $alias) && is_array($alias)) {
        
            return !empty(
    $alias[$field]) ? $alias[$field] . '.' false;
        
        } else {
        
            return;
            
        }


    Using:
    PHP Code:
    $filter = (!empty($_POST['filter'])) ? get_filter($_POST['filter'], array('id' => 'A''date_c' => 'A''date_u' => 'A''title' => 'B')) : '';

    $result mysql_qw('
        SELECT A.id FROM news A
        INNER JOIN news_locale B ON B.news_id = A.id AND B.lang_id = ?
        ' 
    $filter,
        
    $_SESSION['lang']
    ) or die(
    mysql_error()); 
    I hope this code will helpful for anybody =)
    solved..
    thank you very much!!!
    i used key instead value from the beggining!!!
    got all working now!

  6. #396

    Question problem in gridfilter

    i try to use the code for gridfilter. but i failed to do that
    this is my code please help me

    Code:
     var GlobalModel = [
    		// set up the fields mapping into the json
    		{name: 'INVENAVAIL_ID', mapping: 'INVENAVAIL_ID', type:'int'},
    		{name: 'QTY',mapping: 'QTY', type:'string'},
    		{name: 'LINE', mapping: 'LINE', type:'string'},
    		{name: 'GENDER', mapping: 'GENDER', type:'string'},
    		{name: 'TEAMCD', mapping: 'TEAMCD', type:'string'},
    		{name: 'TEAMNAME', mapping: 'TEAMNAME', type:'string'},
    		{name: 'STYLE', mapping: 'STYLE', type:'string'}	
    		]
        
        // create the reader
        var GlobalReader = new Ext.data.CFJsonReader(GlobalModel,{id:'INVENAVAIL_ID'});
    
     	// get the data from coldfusion as json
        var globegrid_ds = new Ext.data.Store({
    		url: 'cfc/salesorder.cfc?method=getInstockReportView&returnFormat=json',
    		reader: GlobalReader,
    		groupField: 'INVENAVAIL_ID' ,
    //		sortInfo: {field: 'INVENAVAIL_ID', direction: 'ASC'},
    //		remoteSort: true,
    		listeners: {
    			loadexception: function(proxy, store, response, e) {         
    			},
    		load: function(){               
    			}
    		}
      	  });
    
    	Ext.ux.grid.filter.StringFilter.prototype.icon = 'img/find.png';
    	Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    	
    	var filters = new Ext.ux.grid.GridFilters({
    		filters:[
    				{type: 'numeric',  dataIndex: 'INVENAVAIL_ID'},						
    				{type: 'string', dataIndex: 'LINE'},
    				{type: 'string',  dataIndex: 'GENDER'},
    				{type: 'string',  dataIndex: 'TEAMCD'},
    				{type: 'string',  dataIndex: 'TEAMNAME'},
    				{type: 'string',  dataIndex: 'STYLE'}
    				
    				]
    		});
    
    
    
    	// create the column model
        var globegridCols = new Ext.grid.ColumnModel([			
    			checkActive,
    			{
    				header: 'Qty', 
    				dataIndex: 'QTY',
    				width: 50,
    				align: 'right',				
    				editor: new Ext.form.NumberField({
    					allowBlank: false,
    					allowNegative: false,					
    					maxValue: 100000
               		})
    			},{
    				header: 'Line', 
    				dataIndex: 'LINE',
    				width: 50
    		   	},{
    				header: 'Gender',
    				width: 40,
    				dataIndex: 'GENDER'
    			},{
    				header: 'Team_cd', 
    				width: 40,
    				dataIndex: 'TEAMCD'
    		   	},{
    				header: 'Team_name',
    				width: 100,
    				dataIndex: 'TEAMNAME'
    		   	},{
    				header: 'Style',
    				width: 50,
    				dataIndex: 'STYLE'
    		   	}
         ]);
    	globegridCols.defaultSortable = true;
      
    	var stockgrid= new Ext.grid.EditorGridPanel({												      	id: 'instockreport',
    		width:900,
    		height:300,
    		ds: globegrid_ds,							
    		cm: globegridCols,						
    		plugins:[checkActive,filters],
    		enableColLock: false,
    		loadMask: true,		
    		viewConfig: {
    			forceFit: true
    		},
    		frame: true/*,
    		clicksToEdit:2,
    		sm: new Ext.grid.RowSelectionModel({singleSelect:true})*/
    	})
    
    	var globewin;
        var button1 = Ext.get('globe-btn');
        button1.on('click', function(){
            // create the window on the first click and reuse on subsequent clicks
            if(!globewin){
                globewin = new Ext.Window({
                    el:'globepopupwin',
                    layout:'fit',
                    width:920,
                    height:300,
                    closeAction:'hide',
                    plain: true,
    				title: 'In Stock Report View',
                    items: 	new Ext.Panel({									  
    					width:900,
    					items : stockgrid,					
    					tbar: [{			
    						text: 'Submit',
    						enableToggle:true,        
    						toggleHandler: updateStockDB		
    					}],
    					bbar: new Ext.PagingToolbar({
                store: globegrid_ds,
                pageSize: 2,
                plugins: filters,
    			displayInfo: true
              })
    				})
    			});
    		}	
    		globewin.show(this);
        });	
    
    		globegrid_ds.load({params:{start:0, limit:8}});
    please help me
    Last edited by mystix; 31 Mar 2008 at 4:44 AM. Reason: USE [code][/code] TAGS!!!!!!!!!

  7. #397

    Default

    Hello!
    The grid filter is working great with me.

    But, i'm wondering if there any way to use the filters if i disable the column's header menu.

  8. #398
    Sencha Premium User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    891

    Default made it localizable..

    Great Extension. One thing i needed to change was the ability to have a custom Text on the Menu-Entry "Filters" and menufilter Texts for BooleanFilter and DateFilter


    GridFilters.js:
    PHP Code:
    ...
        
    menuFilterText'Filters'// ADDED LINE

        
    onRender: function(){
            var 
    hmenu;
            
            if(
    this.showMenu){
                
    hmenu this.grid.getView().hmenu;
                
                
    this.sep  hmenu.addSeparator();
                
    this.menu hmenu.add(new Ext.menu.CheckItem({
    //------------------
                        
    textthis.menuFilterText//<- CHANGED LINE
    //------------------
                        
    menu: new Ext.menu.Menu()
                    }));
                
    this.menu.on('checkchange'this.onCheckChangethis);
                
    this.menu.on('beforecheckchange'this.onBeforeCheckthis);
                    
                
    hmenu.on('beforeshow'this.onMenuthis);
            }
            
            
    this.grid.getView().on("refresh"this.onRefreshthis);
            
    this.updateColumnHeadings(this.grid.getView());
        },
    ... 
    BooleanFilter.js:

    PHP Code:
        yesText'Yes'//ADDED LINE
        
    noText'No'//ADDED LINE

        
    init: function(){
        var 
    gId Ext.id();
            
    this.options = [
                new 
    Ext.menu.CheckItem({textthis.yesTextgroupgIdchecked this.defaultValue === true}), //CHANGED LINE
                
    new Ext.menu.CheckItem({textthis.noTextgroupgIdcheckedthis.defaultValue === false})]; //CHANGED LINE
            
            
    this.menu.add(this.options[0], this.options[1]);
            
            for(var 
    i=0i<this.options.lengthi++){
                
    this.options[i].on('click'this.fireUpdatethis);
                
    this.options[i].on('checkchange'this.fireUpdatethis);
            }
        }, 
    DateFilter.js:

    PHP Code:
        beforeText'Before',  //ADDED LINE
        
    afterText'After',      //ADDED LINE
        
    onText'On',  //ADDED LINE

        
    init: function(){
            var 
    opts Ext.apply(this.pickerOpts, {
                
    minDatethis.minDate
                
    maxDatethis.maxDate
                
    format:  this.dateFormat
            
    });
            var 
    dates this.dates = {
                
    'before': new Ext.menu.CheckItem({textthis.beforeTextmenu: new Ext.menu.DateMenu(opts)}),  //CHANGED LINE
                
    'after':  new Ext.menu.CheckItem({textthis.afterTextmenu: new Ext.menu.DateMenu(opts)}), //CHANGED LINE
                
    'on':     new Ext.menu.CheckItem({textthis.onTextmenu: new Ext.menu.DateMenu(opts)})}; //CHANGED LINE
                    
            
    this.menu.add(dates.beforedates.after"-"dates.on);
    ... 
    This way you can simply translate it by (e.g. German)

    PHP Code:
    Ext.ux.grid.GridFilters.prototype.menuFilterText 'Filter';
    Ext.ux.grid.filter.BooleanFilter.prototype.yesText 'Ja';
    Ext.ux.grid.filter.BooleanFilter.prototype.noText 'Nein';
    Ext.ux.grid.filter.DateFilter.prototype.beforeText 'vor dem';
    Ext.ux.grid.filter.DateFilter.prototype.afterText 'nach dem';
    Ext.ux.grid.filter.DateFilter.prototype.onText 'am'

  9. #399

    Default

    I try to use list filter with comma inside the filter words, and there no way to devide in request where is comma between list elements or comma inside list element. any ideas to fix this?
    and what about list filter with "filtertext" and "captiontex"?

  10. #400
    Sencha User
    Join Date
    May 2007
    Location
    Germany
    Posts
    84

    Default

    One suggestion for EditableItem:
    I replaced
    Code:
    html: '<img src="' + this.icon + '" class="x-menu-item-icon" style="margin: 3px 3px 2px 2px;" />'});
    with:
    Code:
    html: '<img src="' + (this.icon||Ext.BLANK_IMAGE_URL)+ '" class="x-menu-item-icon'+(this.iconCls?' '+this.iconCls:'')+'" style="margin: 3px 3px 2px 2px;" />'});
    To make it more reusable, if I was intended.

Page 40 of 92 FirstFirst ... 3038394041425090 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •