-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
490 changed files
with
5,868 additions
and
14 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** | ||
* A Grid which creates itself from an existing HTML table element. | ||
*/ | ||
Ext.define('Ext.ux.grid.TransformGrid', { | ||
extend: 'Ext.grid.Panel', | ||
|
||
/** | ||
* Creates the grid from HTML table element. | ||
* @param {String/HTMLElement/Ext.Element} table The table element from which this grid will be created - | ||
* The table MUST have some type of size defined for the grid to fill. The container will be | ||
* automatically set to position relative if it isn't already. | ||
* @param {Object} [config] A config object that sets properties on this grid and has two additional (optional) | ||
* properties: fields and columns which allow for customizing data fields and columns for this grid. | ||
*/ | ||
constructor: function(table, config) { | ||
config = Ext.apply({}, config); | ||
table = this.table = Ext.get(table); | ||
|
||
var configFields = config.fields || [], | ||
configColumns = config.columns || [], | ||
fields = [], | ||
cols = [], | ||
headers = table.query("thead th"), | ||
i = 0, | ||
len = headers.length, | ||
data = table.dom, | ||
width, | ||
height, | ||
store, | ||
col, | ||
text, | ||
name; | ||
|
||
for (; i < len; ++i) { | ||
col = headers[i]; | ||
|
||
text = col.innerHTML; | ||
name = 'tcol-' + i; | ||
|
||
fields.push(Ext.applyIf(configFields[i] || {}, { | ||
name: name, | ||
mapping: 'td:nth(' + (i + 1) + ')/@innerHTML' | ||
})); | ||
|
||
cols.push(Ext.applyIf(configColumns[i] || {}, { | ||
text: text, | ||
dataIndex: name, | ||
width: col.offsetWidth, | ||
tooltip: col.title, | ||
sortable: true | ||
})); | ||
} | ||
|
||
if (config.width) { | ||
width = config.width; | ||
} else { | ||
width = table.getWidth() + 1; | ||
} | ||
|
||
if (config.height) { | ||
height = config.height; | ||
} | ||
|
||
Ext.applyIf(config, { | ||
store: { | ||
data: data, | ||
fields: fields, | ||
proxy: { | ||
type: 'memory', | ||
reader: { | ||
record: 'tbody tr', | ||
type: 'xml' | ||
} | ||
} | ||
}, | ||
columns: cols, | ||
width: width, | ||
height: height | ||
}); | ||
this.callParent([config]); | ||
|
||
if (config.remove !== false) { | ||
// Don't use table.remove() as that destroys the row/cell data in the table in | ||
// IE6-7 so it cannot be read by the data reader. | ||
data.parentNode.removeChild(data); | ||
} | ||
}, | ||
|
||
onDestroy: function() { | ||
this.callParent(); | ||
this.table.remove(); | ||
delete this.table; | ||
} | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* GridFilters Styles | ||
*/ | ||
|
||
.ux-filtered-column { | ||
font-style: italic; | ||
font-weight: bold; | ||
} | ||
|
||
.ux-gridfilter-text-icon { | ||
background-image: url(../images/find.png) !important; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* RangeMenu Styles | ||
*/ | ||
|
||
.ux-rangemenu-icon { | ||
display: block; | ||
height: 16px; | ||
background: no-repeat 5px center; | ||
} | ||
|
||
.ux-rangemenu-gt { | ||
background-image: url(../images/greater_than.png) !important; | ||
} | ||
|
||
.ux-rangemenu-lt { | ||
background-image: url(../images/less_than.png) !important; | ||
} | ||
|
||
.ux-rangemenu-eq { | ||
background-image: url(../images/equals.png) !important; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* Boolean filters use unique radio group IDs (so you can have more than one!) | ||
* <p><b><u>Example Usage:</u></b></p> | ||
* <pre><code> | ||
var filters = Ext.create('Ext.ux.grid.GridFilters', { | ||
... | ||
filters: [{ | ||
// required configs | ||
type: 'boolean', | ||
dataIndex: 'visible' | ||
// optional configs | ||
defaultValue: null, // leave unselected (false selected by default) | ||
yesText: 'Yes', // default | ||
noText: 'No' // default | ||
}] | ||
}); | ||
* </code></pre> | ||
*/ | ||
Ext.define('Ext.ux.grid.filter.BooleanFilter', { | ||
extend: 'Ext.ux.grid.filter.Filter', | ||
alias: 'gridfilter.boolean', | ||
|
||
/** | ||
* @cfg {Boolean} defaultValue | ||
* Set this to null if you do not want either option to be checked by default. Defaults to false. | ||
*/ | ||
defaultValue : false, | ||
/** | ||
* @cfg {String} yesText | ||
* Defaults to 'Yes'. | ||
*/ | ||
yesText : 'Yes', | ||
/** | ||
* @cfg {String} noText | ||
* Defaults to 'No'. | ||
*/ | ||
noText : 'No', | ||
|
||
/** | ||
* @private | ||
* Template method that is to initialize the filter and install required menu items. | ||
*/ | ||
init : function (config) { | ||
var gId = Ext.id(); | ||
this.options = [ | ||
Ext.create('Ext.menu.CheckItem', {text: this.yesText, group: gId, checked: this.defaultValue === true}), | ||
Ext.create('Ext.menu.CheckItem', {text: this.noText, group: gId, checked: this.defaultValue === false})]; | ||
|
||
this.menu.add(this.options[0], this.options[1]); | ||
|
||
for(var i=0; i<this.options.length; i++){ | ||
this.options[i].on('click', this.fireUpdate, this); | ||
this.options[i].on('checkchange', this.fireUpdate, this); | ||
} | ||
}, | ||
|
||
/** | ||
* @private | ||
* Template method that is to get and return the value of the filter. | ||
* @return {String} The value of this filter | ||
*/ | ||
getValue : function () { | ||
return this.options[0].checked; | ||
}, | ||
|
||
/** | ||
* @private | ||
* Template method that is to set the value of the filter. | ||
* @param {Object} value The value to set the filter | ||
*/ | ||
setValue : function (value) { | ||
this.options[value ? 0 : 1].setChecked(true); | ||
}, | ||
|
||
/** | ||
* @private | ||
* Template method that is to get and return serialized filter data for | ||
* transmission to the server. | ||
* @return {Object/Array} An object or collection of objects containing | ||
* key value pairs representing the current configuration of the filter. | ||
*/ | ||
getSerialArgs : function () { | ||
var args = {type: 'boolean', value: this.getValue()}; | ||
return args; | ||
}, | ||
|
||
/** | ||
* Template method that is to validate the provided Ext.data.Record | ||
* against the filters configuration. | ||
* @param {Ext.data.Record} record The record to validate | ||
* @return {Boolean} true if the record is valid within the bounds | ||
* of the filter, false otherwise. | ||
*/ | ||
validateRecord : function (record) { | ||
return record.get(this.dataIndex) == this.getValue(); | ||
} | ||
}); |
Oops, something went wrong.