-
3 Nov 2011 9:24 AM #1
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()).
Thank's!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(); } } } },
-
Best Answer Posted by mitchellsimoens
If you want to cancel a drop, return false in the beforedrop. before events should all be cancelable by returning false.
-
3 Nov 2011 10:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Nov 2011 11:04 AM #3
Perfect!!
But now found other problem:
In resume, if r.existe return true, like stop drop. But i don't have idea how.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; } } }); }) }
Thank's!
-
4 Nov 2011 4:48 AM #4
I decided to bring the value of the validation model and it worked. Thank you!



Reply With Quote