Permalink
Browse files

Rename name->label

  • Loading branch information...
1 parent d51fd71 commit 84fa398b34ec1db4078e18227d4fe13f93fbe097 @kriszyp kriszyp committed Aug 15, 2011
View
@@ -148,7 +148,7 @@ return function(column, editor, editOn){
renderWidget(value, cell, object);
}
}
- if(!column.name){
+ if(!column.label){
column.renderHeaderCell = function(th){
column.renderCell({}, null, th);
}
View
@@ -173,8 +173,8 @@ define(["dojo/has", "xstyle/put", "dojo/_base/declare", "dojo/on", "./Editor", "
// allow for custom header manipulation
if(column.renderHeaderCell){
column.renderHeaderCell(th);
- }else if(column.name || column.field){
- th.appendChild(document.createTextNode(column.name || column.field));
+ }else if(column.label || column.field){
+ th.appendChild(document.createTextNode(column.label || column.field));
}
if(column.sortable !== false){
th.sortable = true;
@@ -223,7 +223,7 @@ define(["dojo/has", "xstyle/put", "dojo/_base/declare", "dojo/on", "./Editor", "
for(var columnId in rowColumns){
var column = rowColumns[columnId];
if(typeof column == "string"){
- rowColumns[columnId] = column = {name:column};
+ rowColumns[columnId] = column = {label:column};
}
if(!isArray && !column.field){
column.field = columnId;
View
@@ -19,7 +19,7 @@ define(["./Grid", "dojo/_base/declare", "dojo/_base/lang"], function(Grid, decla
for(var j = 0; j < thslen; j++){
var th = ths[j];
rowColumns.push({
- name: th.innerHTML,
+ label: th.innerHTML,
field: th.getAttribute("field") || th.className || th.innerHTML,
className: th.className,
// TODO: test editable/sortable
View
@@ -53,11 +53,11 @@ define(["dgrid/Grid"], function(List){
var grid = new Grid({
columns: {
first: {
- name: "First Name",
+ label: "First Name",
sortable: true
},
last: {
- name: "Last Name",
+ label: "Last Name",
sortable: true
},
age: {
@@ -134,8 +134,8 @@ define(["dgrid/OnDemandGrid"], function(Grid){
grid = new Grid({
store: myStore, // a Dojo object store
columns: [ // define the columns
- {name: 'Column 1', field: 'col1', editable: true, sortable: true},
- {name: 'Column 2', field: 'col2'},
+ {label: 'Column 1', field: 'col1', editable: true, sortable: true},
+ {label: 'Column 2', field: 'col2'},
...
]
}, "grid"); ...
@@ -230,11 +230,11 @@ define(["dgrid/OnDemandGrid", "dgrid/Tree", "dgrid/Editor"], function(Grid, Tree
store: myHierarchicalStore, // a Dojo object store
columns: [ // define the columns
// first column will have a tree expander:
- Tree({name:'Name', field:'name'}),
+ Tree({label:'Name', field:'name'}),
// second column will render with a checkbox:
- Editor({name: 'A CheckBox', field: 'bool'}, "checkbox"),
+ Editor({label: 'A CheckBox', field: 'bool'}, "checkbox"),
// just a normal column:
- {name:'Type', field:'type'},
+ {label:'Type', field:'type'},
...
]
}, "grid"); ...
View
@@ -3,7 +3,7 @@ function(create, List){
with(create){
var column = Object("Column definition", {
field: String("The property from the data objects to retrieve for display in this column"),
- name: String("The label to use in the column header"),
+ label: String("The label to use in the column header"),
sortable: Boolean("The property from the data objects to retrieve for display in this column"),
className: String("The CSS classname to apply to the DOM element for the cells in this column"),
id: String("The column id"),
View
@@ -42,7 +42,7 @@ function(dojo, on, put, Grid, Tree, Selection, Keyboard, Memory){
store: store,
columns: {
docType: new Tree({
- name:'Part',
+ label:'Part',
renderCell: function(object, value, td){
put(td, "div.ui-icon.type.type-" + object.docType + "[title=" + object.docType + "]");
put(td, "div.description", (object.name || "") + (object.type ? ':' + object.type : '') +
@@ -43,10 +43,10 @@
function(on, Grid, ColumnResizer, testStore){
var columns = { // you can declare columns as an object hash (key translates to field)
col1: 'Column 1',
- col2: {name: 'Column 2', sortable: false},
+ col2: {label: 'Column 2', sortable: false},
col3: 'Column 3',
col4: 'Column 4',
- "last-col": {name: 'Column 5', field: 'col5'}
+ "last-col": {label: 'Column 5', field: 'col5'}
};
window.grid = dojo.declare([Grid, ColumnResizer])({
store: testStore,
@@ -56,11 +56,11 @@
function(on, List, Grid, Tree, Editor, TextBox, Selection, Keyboard, testStore){
console.log("loaded in " + (new Date().getTime() - start) + testStore);
var columns = { // you can declare columns as an object hash (key translates to field)
- col1: TextBox({name: 'Column 1'}),
- col2: {name: 'Column 2', sortable: false},
- col3: TextBox({name: 'Column 3'}),
+ col1: TextBox({label: 'Column 1'}),
+ col2: {label: 'Column 2', sortable: false},
+ col3: TextBox({label: 'Column 3'}),
col4: 'Column 4',
- "last-col": TextBox({name: 'Column 5', field: 'col5'})
+ "last-col": TextBox({label: 'Column 5', field: 'col5'})
};
window.grid = dojo.declare([Grid, Selection, Keyboard])({
store: testStore,
@@ -71,9 +71,9 @@
query: {type: "continent"},
selectionMode: "single",
columns: {
- name: new Tree({name:'Name', sortable: false}),
- bool: new Editor({name: 'A CheckBox', sortable: false}, "checkbox"),
- type: {name: 'Type', sortable: false},
+ name: new Tree({label:'Name', sortable: false}),
+ bool: new Editor({label: 'A CheckBox', sortable: false}, "checkbox"),
+ type: {label: 'Type', sortable: false},
population: 'Population',
timezone: 'Timezone'
}
@@ -87,9 +87,6 @@
grid.save();
});
});
- function reflow(){
-
- }
</script>
</head>
<body class="claro">
@@ -12,10 +12,10 @@
font-weight: bold;
padding-bottom: 0.25em;
}
- #grid {
+ #grid {
width: 70%;
}
- #grid .column-set-0 {
+ #grid .column-set-0 {
width: 50%;
}
#grid .field-col1 {
@@ -44,13 +44,13 @@
store: testStore,
columnSets: [
[
- [{name: 'Column 1', field: 'col1'},
- {name: 'Column 2', field: 'col2', sortable: false}],
- [{name: 'Column 3', field: 'col3', colSpan: 2}]],
+ [{label: 'Column 1', field: 'col1'},
+ {label: 'Column 2', field: 'col2', sortable: false}],
+ [{label: 'Column 3', field: 'col3', colSpan: 2}]],
[
- [{name: 'Column 1', field: 'col1', rowSpan: 2},
- {name: 'Column 4', field: 'col4'}],
- [{name: 'Column 5', field: 'col5'}]]]
+ [{label: 'Column 1', field: 'col1', rowSpan: 2},
+ {label: 'Column 4', field: 'col4'}],
+ [{label: 'Column 5', field: 'col5'}]]]
}, "grid");
});
</script>
View
@@ -45,14 +45,14 @@
window.grid1 = new (dojo.declare([Grid, Selection, DndRow, Keyboard]))({
store: testOrderedStore,
columns: [
- {name:'Name', field:'name'},
- {name:'Description', field:'description'}
+ {label:'Name', field:'name'},
+ {label:'Description', field:'description'}
]
}, "grid1");
window.grid2 = new (dojo.declare([Grid, Selection, DndRow, Keyboard]))({
store: createOrderedStore([]),
columns: [
- {name:'Name', field:'name'}
+ {label:'Name', field:'name'}
]
}, "grid2");
var anotherTargetDiv = dojo.byId("another-target");
@@ -79,12 +79,12 @@
source.insertNodes(false, [
{ type: ["row"], data: new nameObj({
order: 10,
- name: "do a dance",
+ label: "do a dance",
description: "Dance like nobody's watching."
})},
{ type: ["row"], data: new nameObj({
order: 11,
- name: "genuflect",
+ label: "genuflect",
description: "Take a knee."
})}
], false, null);
@@ -29,16 +29,16 @@
require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Tree","dgrid/Selection", "dgrid/Keyboard", "dgrid/Editor", "dijit/form/DateTextBox", "dijit/form/HorizontalSlider", "dijit/form/NumberSpinner", "dgrid/test/test_data", "dojo/domReady!"],
function(List, Grid, Tree, Selection, Keyboard, Editor, DateTextBox, Slider, NumberSpinner){
var columns = [
- Editor({name: 'A Date', field: 'date'}, DateTextBox),
- Editor({name: 'Real Number', field: 'floatNum'}, Slider),
- Editor({name: 'Integer', field: 'integer'}, NumberSpinner),
- Editor({name: 'Text editable if checkbox checked', field: 'text', canEdit: function(object){
+ Editor({label: 'A Date', field: 'date'}, DateTextBox),
+ Editor({label: 'Real Number', field: 'floatNum'}, Slider),
+ Editor({label: 'Integer', field: 'integer'}, NumberSpinner),
+ Editor({label: 'Text editable if checkbox checked', field: 'text', canEdit: function(object){
return object.bool;
}}, "text", "dblclick"),
- {name: 'Non editable text', field: 'text', sortable: false},
- Editor({name: 'Another Date', field: 'date2'}, DateTextBox, "focus"),
- Editor({name: 'CheckBox', field: 'bool'}, "checkbox"),
- Editor({name: 'Radio', selector: true}, "radio")
+ {label: 'Non editable text', field: 'text', sortable: false},
+ Editor({label: 'Another Date', field: 'date2'}, DateTextBox, "focus"),
+ Editor({label: 'CheckBox', field: 'bool'}, "checkbox"),
+ Editor({label: 'Radio', selector: true}, "radio")
];
window.grid = new (dojo.declare([Grid, Selection, Keyboard]))({
store: testTypesStore,
View
@@ -22,11 +22,11 @@
require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Tree","dgrid/Selection", "dgrid/Keyboard", "dgrid/test/test_data", "dojo/domReady!"],
function(List, Grid, Tree, Selection, Keyboard, ProgressBar){
var columns = [
- {name: 'Column 1', field: 'col1'},
- {name: 'Column 2', field: 'col2', sortable: false},
- {name: 'Column 3', field: 'col3'},
- {name: 'Column 4', field: 'col4'},
- {name: 'Column 5', field: 'col5'}
+ {label: 'Column 1', field: 'col1'},
+ {label: 'Column 2', field: 'col2', sortable: false},
+ {label: 'Column 3', field: 'col3'},
+ {label: 'Column 4', field: 'col4'},
+ {label: 'Column 5', field: 'col5'}
];
window.grid = new (dojo.declare([Grid, Selection, Keyboard]))({
store: testStore,
@@ -75,12 +75,12 @@
};
var columnsNew = {
order: {
- name: "Step",
+ label: "Step",
sortable: false,
renderCell: testRenderCell
},
- name: {},
- description: {name: "what to do", sortable: false}
+ label: {},
+ description: {label: "what to do", sortable: false}
};
require(["dgrid/Grid", "dgrid/GridFromHtml", "dojo/domReady!"], function(Grid, GridFromHtml){
// fully-programmatic tests
@@ -25,9 +25,9 @@
function(Grid, Editor, Selection, CellSelection, Keyboard, testStore){
var columns = {
col1: 'Column 1',
- col2: {name: 'Column 2', sortable: false},
+ col2: {label: 'Column 2', sortable: false},
col3: 'Column 3',
- col4: Editor({name: 'Editable'}, "text")
+ col4: Editor({label: 'Editable'}, "text")
};
gridRowNavigation = dojo.declare([Grid, Selection, Keyboard])({
store: testStore,
@@ -36,7 +36,7 @@
}, "grid-row-navigation");
var columns2 = {
col1: 'Column 1',
- col2: {name: 'Column 2', sortable: false},
+ col2: {label: 'Column 2', sortable: false},
col3: 'Column 3',
col4: 'Column 4'
};
@@ -28,18 +28,20 @@
function(Grid, Editor, Selection, Keyboard, testStore){
var columns = { // you can declare columns as an object hash (key translates to field)
col1: Editor({selector: true, sortable: false}, "checkbox"),
- col2: {name: 'Column 2', sortable: false},
- col3: {name: 'Column 3'}
+ id: "ID",
+ col2: {label: 'Column 2', sortable: false},
+ col3: {label: 'Column 3'}
};
window.grid = dojo.declare([Grid, Selection, Keyboard])({
store: testStore,
selectionMode: "none",
columns: columns
}, "grid");
var columnsRadio = { // you can declare columns as an object hash (key translates to field)
- col1: Editor({name: 'Radio', selector: true, sortable: false}, "radio"),
- col2: {name: 'Column 2', sortable: false},
- col3: {name: 'Column 3'}
+ col1: Editor({label: 'Radio', selector: true, sortable: false}, "radio"),
+ id: "ID",
+ col2: {label: 'Column 2', sortable: false},
+ col3: {label: 'Column 3'}
};
window.gridRadio = dojo.declare([Grid, Selection, Keyboard])({
store: testStore,
@@ -25,8 +25,8 @@
];
var columns = {
order: "step", // give column a custom name
- name: {},
- description: {name: "what to do", sortable: false}
+ label: {},
+ description: {label: "what to do", sortable: false}
};
require(["dgrid/Grid", "dojo/domReady!"],
function(Grid){
View
@@ -106,12 +106,12 @@
};
var columns = [
- {name: 'Name', field: 'Name'},
- {name: 'Duration', field: 'Time', formatter: timeFormatter},
- {name: 'Year', field: 'Year'},
- {name: 'Artist', field: 'Artist'},
- {name: 'Album', field: 'Album'},
- {name: 'Genre', field: 'Genre'}
+ {label: 'Name', field: 'Name'},
+ {label: 'Duration', field: 'Time', formatter: timeFormatter},
+ {label: 'Year', field: 'Year'},
+ {label: 'Artist', field: 'Artist'},
+ {label: 'Album', field: 'Album'},
+ {label: 'Genre', field: 'Genre'}
];
window.grid = new (dojo.declare([Grid, Selection, Keyboard]))({
store: songStore,
View
@@ -22,11 +22,11 @@
require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Tree","dgrid/Selection", "dgrid/Keyboard", "dgrid/test/test_data", "dojo/domReady!"],
function(List, Grid, Tree, Selection, Keyboard, ProgressBar){
var columns = [
- {name: 'Column 1', field: 'col1'},
- {name: 'Column 2', field: 'col2', sortable: false},
- {name: 'Column 3', field: 'col3'},
- {name: 'Column 4', field: 'col4'},
- {name: 'Column 5', field: 'col5'}
+ {label: 'Column 1', field: 'col1'},
+ {label: 'Column 2', field: 'col2', sortable: false},
+ {label: 'Column 3', field: 'col3'},
+ {label: 'Column 4', field: 'col4'},
+ {label: 'Column 5', field: 'col5'}
];
window.grid = new (dojo.declare([Grid, Selection, Keyboard]))({
store: testStore,
View
@@ -25,11 +25,11 @@
require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Tree","dgrid/Selection", "dgrid/Keyboard", "dgrid/test/test_data", "dojo/domReady!"],
function(List, Grid, Tree, Selection, Keyboard, ProgressBar){
var columns = [
- {name: 'Column 1', field: 'col1'},
- {name: 'Column 2', field: 'col2', sortable: false},
- {name: 'Column 3', field: 'col3'},
- {name: 'Column 4', field: 'col4'},
- {name: 'Column 5', field: 'col5'}
+ {label: 'Column 1', field: 'col1'},
+ {label: 'Column 2', field: 'col2', sortable: false},
+ {label: 'Column 3', field: 'col3'},
+ {label: 'Column 4', field: 'col4'},
+ {label: 'Column 5', field: 'col5'}
];
window.grid = new (dojo.declare([Grid, Selection, Keyboard]))({
store: testStore,
@@ -29,11 +29,11 @@
require(["dojo/on", "dgrid/OnDemandGrid","dgrid/Tree","dgrid/Editor", "dgrid/Keyboard", "dgrid/Selection", "dgrid/test/test_data", "dojo/domReady!"],
function(on, Grid, Tree, Editor, Keyboard, Selection, testStore){
var columns = [
- Tree({name:'Name', field:'name', sortable: false}),
- Editor({name: 'A CheckBox', field: 'bool', sortable: false}, "checkbox"),
- Editor({name:'Type', field:'type', sortable: false}, "text"),
- Editor({name:'Population', field:'population'}, "text", "dblclick"),
- Editor({name:'Timezone', field:'timezone'}, "text", "dblclick")
+ Tree({label:'Name', field:'name', sortable: false}),
+ Editor({label: 'A CheckBox', field: 'bool', sortable: false}, "checkbox"),
+ Editor({label:'Type', field:'type', sortable: false}, "text"),
+ Editor({label:'Population', field:'population'}, "text", "dblclick"),
+ Editor({label:'Timezone', field:'timezone'}, "text", "dblclick")
];
window.tree = dojo.declare([Grid, Keyboard, Selection])({
Oops, something went wrong.

0 comments on commit 84fa398

Please sign in to comment.