1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    9
    Vote Rating
    0
    mfoley is on a distinguished road

      0  

    Default Ext.ux.GridRowDeleter

    Ext.ux.GridRowDeleter


    Hey guys, here's a little something i threw together for a project I'm working on. It's just a grid plugin that you include in the column model that deletes the grid row when click.
    JS:
    PHP Code:
    Ext.ux.GridRowDeleter = function(config){
        
    Ext.applyIf(config,{
            
    renderer:function(value,meta){meta.css='x-grid3-row-deleter';return '<div ext:qtip="Delete Row"> </div>'},
            
    id:Ext.id(null,'x-grid3-row-deleter'),
            
    header:'<div class="x-grid3-row-deleter"> </div>',
            
    width:25
        
    });
        
    Ext.apply(this,config);
        
    this.getColumnIndex = function(){
            return 
    this.grid.getColumnModel().getIndexById(this.id);
        },
        
    this.onClick = function(grid,rowIndex,columnIndex){
            if(
    columnIndex == this.getColumnIndex()){
                
    grid.getStore().remove(grid.getStore().getAt(rowIndex));
            }
        };
        
    this.init = function(grid){
            
    this.grid grid;
            
    this.grid.on('cellclick',this.onClick,this);
        }

    CSS:
    Code:
    td.x-grid3-row-deleter{
    	background:url('/path_to_silk_icons/delete.png') no-repeat scroll 0% !important;
    }

  2. #2
    Ext User denkoo's Avatar
    Join Date
    Jan 2008
    Location
    Paris
    Posts
    124
    Vote Rating
    0
    denkoo is on a distinguished road

      0  

    Red face do you have a demo please !!?

    do you have a demo please !!?


    Thanks

  3. #3
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Nice idea would be to add a 'remote' mode where request to delete would be sent to server and only if successful the row would be deleted from grid's store.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  4. #4
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    One more note: Have you seen this: Grid RowAction Plugin?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  5. #5
    Ext User
    Join Date
    Apr 2007
    Posts
    9
    Vote Rating
    0
    mfoley is on a distinguished road

      0  

    Default


    No, I hadn't. Thanks for that. I threw together a "row duplicator" using the same idea. Using those action related column models really seems to save the need for a lot of context menu coding!

Thread Participants: 2