X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/air/samples/tasks/js/columns.js?ds=sidebyside diff --git a/air/samples/tasks/js/columns.js b/air/samples/tasks/js/columns.js deleted file mode 100644 index b8c10c74..00000000 --- a/air/samples/tasks/js/columns.js +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Ext JS Library 0.30 - * Copyright(c) 2006-2009, Ext JS, LLC. - * licensing@extjs.com - * - * http://extjs.com/license - */ - -// Grid column plugin that does the complete/active button in the left-most column -CompleteColumn = function(){ - var grid; - - function getRecord(t){ - var index = grid.getView().findRowIndex(t); - return grid.store.getAt(index); - } - - function onMouseDown(e, t){ - if(Ext.fly(t).hasClass('task-check')){ - e.stopEvent(); - var record = getRecord(t); - record.set('completed', !record.data.completed); - grid.store.applyFilter(); - } - } - - function onMouseOver(e, t){ - if(Ext.fly(t).hasClass('task-check')){ - Ext.fly(t.parentNode).addClass('task-check-over'); - } - } - - function onMouseOut(e, t){ - if(Ext.fly(t).hasClass('task-check')){ - Ext.fly(t.parentNode).removeClass('task-check-over'); - } - } - - Ext.apply(this, { - width: 22, - header: '
', - fixed: true, - menuDisabled: true, - id: 'task-col', - renderer: function(){ - return ''; - }, - init : function(xg){ - grid = xg; - grid.on('render', function(){ - var view = grid.getView(); - view.mainBody.on('mousedown', onMouseDown); - view.mainBody.on('mouseover', onMouseOver); - view.mainBody.on('mouseout', onMouseOut); - }); - } - }); -}; - - -ReminderColumn = function(){ - var grid, menu, record; - - function getRecord(t){ - var index = grid.getView().findRowIndex(t); - return grid.store.getAt(index); - } - - function onMenuCheck(item){ - if(item.reminder === false){ - record.set('reminder', ''); - }else{ - var s = record.data.dueDate ? record.data.dueDate.clearTime(true) : new Date().clearTime(); - s = s.add('mi', Ext.state.Manager.get('defaultReminder')); - s = s.add('mi', item.reminder*-1); - record.set('reminder', s); - } - } - - function getMenu(){ - if(!menu){ - menu = new Ext.menu.Menu({ - plain: true, - items: [{ - text: 'No Reminder', - reminder: false, - handler: onMenuCheck - },'-',{ - text: 'On the Due Date', - reminder: 0, - handler: onMenuCheck - },'-',{ - text: '1 day before', - reminder: 24*60, - handler: onMenuCheck - },{ - text: '2 days before', - reminder: 48*60, - handler: onMenuCheck - },{ - text: '3 days before', - reminder: 72*60, - handler: onMenuCheck - },{ - text: '1 week before', - reminder: 7*24*60, - handler: onMenuCheck - },{ - text: '2 weeks before', - reminder: 14*24*60, - handler: onMenuCheck - },'-',{ - text: 'Set Default Time...', - handler: function(){ - Ext.air.NativeWindowManager.getPrefWindow(); - } - }] - }); - } - return menu; - } - - function onMouseDown(e, t){ - if(Ext.fly(t).hasClass('reminder')){ - e.stopEvent(); - record = getRecord(t); - if (!record.data.completed) { - var rmenu = getMenu(); - rmenu.show(t, 'tr-br?'); - } - } - } - - function onMouseOver(e, t){ - if(Ext.fly(t).hasClass('reminder')){ - Ext.fly(t.parentNode).addClass('reminder-over'); - } - } - - function onMouseOut(e, t){ - if(Ext.fly(t).hasClass('reminder')){ - Ext.fly(t.parentNode).removeClass('reminder-over'); - } - } - - Ext.apply(this, { - width: 26, - header: '', - fixed: true, - id: 'reminder-col', - menuDisabled: true, - dataIndex:'reminder', - renderer: function(v){ - return ''; - }, - init : function(xg){ - grid = xg; - grid.on('render', function(){ - var view = grid.getView(); - view.mainBody.on('contextmenu', onMouseDown); - view.mainBody.on('mousedown', onMouseDown); - view.mainBody.on('mouseover', onMouseOver); - view.mainBody.on('mouseout', onMouseOut); - }); - } - }); -}; \ No newline at end of file