Created
August 19, 2012 18:49
-
-
Save brian428/3397012 to your computer and use it in GitHub Desktop.
TodoPanel.coffee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define( "ExtCoffeeTodo.view.TodoPanel", | |
extend: "Ext.grid.Panel" | |
alias: "widget.extcoffeetodo-view-todoPanel" | |
requires: [ "Ext.ux.CheckColumn", "ExtCoffeeTodo.store.TodoStore" ] | |
inject: [ "todoStore" ] | |
controller: "ExtCoffeeTodo.controller.TodoController" | |
layout: "anchor" | |
title: "ExtJS and CoffeeScript Todo List" | |
# Grid plugin to allow inline editing. | |
cellEditing: Ext.create( "Ext.grid.plugin.CellEditing", | |
clicksToEdit: 1 | |
) | |
initComponent: -> | |
Ext.applyIf( @, | |
store: @todoStore | |
emptyText: "There are no Todos yet." | |
columns: [ | |
header: "Todo Description" | |
dataIndex: "description" | |
flex: 1 #Lets column width adapt to grid width | |
editor: | |
emptyText: "Enter Todo Description" | |
allowBlank: false | |
, | |
text: "Created" | |
dataIndex: "dateCreated" | |
xtype: "datecolumn" | |
format: "m-d-Y g:i A" | |
width: 150 | |
, | |
xtype: "checkcolumn" | |
itemId: "completeColumn" | |
header: "Complete" | |
dataIndex: "complete" | |
width: 80 | |
] | |
selModel: | |
selType: "cellmodel" | |
frame: true | |
tbar: [ | |
text: "Add Todo" | |
itemId: "addButton" | |
, | |
"->" # Shortcut for spacer | |
, | |
xtype: "checkbox" | |
itemId: "showCompletedCheckbox" | |
boxLabel: "Show Completed?" | |
boxLabelCls: "toolbar-box-label" | |
] | |
plugins: [ | |
@cellEditing | |
] | |
) | |
@callParent( arguments ) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment