1. #1
    Sencha User fabio.policeno's Avatar
    Join Date
    Sep 2010
    Location
    Curitiba - PR / Brasil
    Posts
    308
    Vote Rating
    5
    Answers
    16
    fabio.policeno is on a distinguished road

      0  

    Default Answered: Don't allow drop of record grid (gridviewdragdrop)

    Answered: Don't allow drop of record grid (gridviewdragdrop)


    Hello
    I need to block the line of the grid drop if the value of column1 is 0, for this example: http://docs.sencha.com/ext-js/4-0/#!...d_to_grid.html

    I tried like this, but I view returns the error dropZone is not defined(view.dropZone.lock()).

    Code:
    viewConfig: {
               ...
                listeners: {
                    ...
                    beforedrop: function(node, data, dropRec, dropPosition) {
                        if(data.records[0].get('column1') == 0)
                        {
                            data.view.dropZone.lock();
                        }
                        else
                        {
                            data.view.dropZone.unlock();
                        }
                    }
                }
            },
    Thank's!

  2. If you want to cancel a drop, return false in the beforedrop. before events should all be cancelable by returning false.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,641
    Vote Rating
    898
    Answers
    3573
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you want to cancel a drop, return false in the beforedrop. before events should all be cancelable by returning false.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User fabio.policeno's Avatar
    Join Date
    Sep 2010
    Location
    Curitiba - PR / Brasil
    Posts
    308
    Vote Rating
    5
    Answers
    16
    fabio.policeno is on a distinguished road

      0  

    Default


    Perfect!!

    But now found other problem:
    Code:
    verificarExisteTurma: function(dragZone, item){
            var me = this, 
                registros = item.records;
                
            Ext.each(registros, function(registro){
                var idAnoAcademico = registro.get('IDAnoAcademico'),
                    idNivelEnsino = registro.get('IDNivelEnsino');
                
                Ext.Ajax.request({
                    url       : URLADMIN + '/turma/existeAnoAcademico/',
                    params : {
                        IDAnoAcademico: idAnoAcademico,
                        IDCliente      : me.idRegistro
                    },
                    success: function(resposta){
                        var r = Ext.decode(resposta.responseText);
                        if(r.existe){
                                
                            return false;
                        }
                    }
                });
            })
        }
    In resume, if r.existe return true, like stop drop. But i don't have idea how.

    Thank's!

  5. #4
    Sencha User fabio.policeno's Avatar
    Join Date
    Sep 2010
    Location
    Curitiba - PR / Brasil
    Posts
    308
    Vote Rating
    5
    Answers
    16
    fabio.policeno is on a distinguished road

      0  

    Default


    I decided to bring the value of the validation model and it worked. Thank you!

Thread Participants: 1