this.dataSource= Roo.factory(this.dataSource, Roo.data);
this.ds = this.dataSource;
this.ds.xmodule = this.xmodule || false;
-
+
}
*/
loadMask : false,
/**
- * @cfg {Roo.dd.DropTarget} dragTarget An {@link Roo.dd.DragTarget} config
+ * @cfg {Roo.dd.DropTarget} dropTarget An {@link Roo.dd.DropTarget} config
*/
dropTarget: false,
+
+
// private
rendered : false,
* Called once after all setup has been completed and the grid is ready to be rendered.
* @return {Roo.grid.Grid} this
*/
- render : function(){
+ render : function()
+ {
var c = this.container;
// try to detect autoHeight/width mode
if((!c.dom.offsetHeight || c.dom.offsetHeight < 20) || c.getStyle("height") == "auto"){
c.on("dblclick", this.onDblClick, this);
c.on("contextmenu", this.onContextMenu, this);
c.on("keydown", this.onKeyDown, this);
+ if (Roo.isTouch) {
+ c.on("touchstart", this.onTouchStart, this);
+ }
this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]);
if (this.toolbar && this.toolbar.xtype) {
this.toolbar.container = this.getView().getHeaderPanel(true);
- this.toolbar = new Ext.Toolbar(this.toolbar);
+ this.toolbar = new Roo.Toolbar(this.toolbar);
}
if (this.footer && this.footer.xtype) {
this.footer.dataSource = this.getDataSource();
}
if (this.dropTarget && this.dropTarget.xtype) {
delete this.dropTarget.xtype;
- this.dropTarget = new Ext.dd.DropTarget(this.getView().mainBody, this.dropTarget);
+ this.dropTarget = new Roo.dd.DropTarget(this.getView().mainBody, this.dropTarget);
}
// private
processEvent : function(name, e){
- this.fireEvent(name, e);
+ // does this fire select???
+ //Roo.log('grid:processEvent ' + name);
+
+ if (name != 'touchstart' ) {
+ this.fireEvent(name, e);
+ }
+
var t = e.getTarget();
var v = this.view;
var header = v.findHeaderIndex(t);
if(header !== false){
- this.fireEvent("header" + name, this, header, e);
+ var ename = name == 'touchstart' ? 'click' : name;
+
+ this.fireEvent("header" + ename, this, header, e);
}else{
var row = v.findRowIndex(t);
var cell = v.findCellIndex(t);
+ if (name == 'touchstart') {
+ // first touch is always a click.
+ // hopefull this happens after selection is updated.?
+ name = false;
+
+ if (typeof(this.selModel.getSelectedCell) != 'undefined') {
+ var cs = this.selModel.getSelectedCell();
+ if (row == cs[0] && cell == cs[1]){
+ name = 'dblclick';
+ }
+ }
+ if (typeof(this.selModel.getSelections) != 'undefined') {
+ var cs = this.selModel.getSelections();
+ var ds = this.dataSource;
+ if (cs.length == 1 && ds.getAt(row) == cs[0]){
+ name = 'dblclick';
+ }
+ }
+ if (!name) {
+ return;
+ }
+ }
+
+
if(row !== false){
this.fireEvent("row" + name, this, row, e);
if(cell !== false){
onClick : function(e){
this.processEvent("click", e);
},
+ // private
+ onTouchStart : function(e){
+ this.processEvent("touchstart", e);
+ },
// private
onContextMenu : function(e, t){