-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grid Select Improvements #138
Changes from 3 commits
bc88934
3069659
0ab2215
8de25c0
8338feb
bbbdff6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
define([ | ||
'./catch/NoFishException', | ||
|
||
'dgrid/Editor', | ||
'dgrid/Keyboard', | ||
'dgrid/OnDemandGrid', | ||
'dgrid/Selection', | ||
|
||
'dijit/form/NumberSpinner', | ||
|
||
'dojo/keys', | ||
'dojo/on', | ||
'dojo/topic', | ||
'dojo/_base/array', | ||
'dojo/_base/declare', | ||
'dojo/_base/lang', | ||
|
@@ -15,13 +19,17 @@ define([ | |
'dstore/Trackable' | ||
], function ( | ||
NoFishException, | ||
|
||
Editor, | ||
Keyboard, | ||
DGrid, | ||
Selection, | ||
|
||
NumberSpinner, | ||
|
||
keys, | ||
on, | ||
topic, | ||
array, | ||
declare, | ||
lang, | ||
|
@@ -32,6 +40,16 @@ define([ | |
// summary: | ||
// Mixin to add dgrid to a widget. | ||
return declare(null, { | ||
// this is to remove the default NaN value if there is an empty string | ||
// it's used as a column editor in classes that use this mixin | ||
NewNumberSpinner: declare([NumberSpinner], { | ||
value: null, | ||
_getValueAttr() { | ||
const inheritedValue = this.inherited(arguments); | ||
|
||
return isNaN(inheritedValue) ? null : inheritedValue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mess up the data submission or any of the local storage stuff? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. In fact, it fixes problems such as attempting to write a string ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does 0 get written to the db for empty records? |
||
} | ||
}), | ||
|
||
// grid: DGrid | ||
grid: null, | ||
|
@@ -63,6 +81,19 @@ define([ | |
on(this.grid, 'dgrid-deselect', lang.hitch(this, this.onRowDeselected)); | ||
|
||
this.setGridData([]); | ||
|
||
this.own( | ||
topic.subscribe(`refocus_${this.id}`, (columnIndex) => { | ||
for (var id in this.grid.selection) { | ||
if (this.grid.selection.hasOwnProperty(id)) { | ||
// columnIndex needs to be a string | ||
const cell = this.grid.cell(id, columnIndex + ''); | ||
console.log(cell); | ||
this.grid.edit(cell); | ||
} | ||
} | ||
}) | ||
); | ||
}, | ||
onRowSelected: function (evt) { | ||
// summary: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need to be polyfilled if people are using IE at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought that Babel would take care of this one for me. I'm not too worried about supporting IE at this point for this project.