:: Forum >>
Will multi-select features return?
2.0 seems to have lost the ability to shift+click to select a range of rows. Also, ctrl-A would be nice to select all rows. Any hope of this?
Bill
Wednesday, February 1, 2006
If you do need it at the moment, then you can add the following to _multirow.js and _actions.js in the folder source/lib/grid
_multirow.js
onRowShiftClicked: "toggleClickedRows",
_actions.js
toggleClickedRows: f(toggleRows, arg1),
function toggleRows(r){
var selectedRows = this.getSelectedRows();
var lastRow = selectedRows[selectedRows.length-1];
var rowIndices = this.getRowIndices();
var lastIndex = this.getRowPosition(lastRow);
var currentIndex = this.getRowPosition(r);
var largestIndex = lastIndex > currentIndex ? lastIndex : currentIndex;
var smallestIndex = lastIndex > currentIndex ? currentIndex : lastIndex;
for (var i=smallestIndex; i<=largestIndex; i++) {
var index = rowIndices[i];
this.setRowSelected(true, index);
}
this.setCurrentRow(r);
}
Helen Williamson
Wednesday, February 1, 2006
Helen,
I found your original post.
I've made the changes in my AW code as you have described above - but no joy. Do I need to "switch-on" shiftclicking in some way in my Grid Object ?
-----------------------------------------------
_action.js fragment
...
function toggleRow(r){
this.setRowSelected(!this.getRowSelected(r), r);
}
/****
added in fix from Helen Williamson for dealing with
multiple row selects
AW/javascript.forum.11188.1/will-multi-select-features-return.html
****/
function toggleRows(r){
var selectedRows = this.getSelectedRows();
var lastRow = selectedRows[selectedRows.length-1];
var rowIndices = this.getRowIndices();
var lastIndex = this.getRowPosition(lastRow);
var currentIndex = this.getRowPosition(r);
var largestIndex = lastIndex > currentIndex ? lastIndex : currentIndex;
var smallestIndex = lastIndex > currentIndex ? currentIndex : lastIndex;
for (var i=smallestIndex; i<=largestIndex; i++) {
var index = rowIndices[i];
this.setRowSelected(true, index);
}
this.setCurrentRow(r);
}
function f(action, column, row){
....
-----------------------------------------------
_multirow.js fragment
...
onRowClicked: "selectClickedRow",
onRowShiftClicked: "toggleClickedRows",
onRowCtrlClicked: "toggleClickedRow"};
...
Yasdnil
Friday, March 3, 2006
Soory, I should have said - that setting a breakpoint in the first line of your toggleRows function never gets hit. Its like the event itself is not being handled ?
Which leads me to think that I need to enable the event on my Grid Object somehow!
Yasdnil
Friday, March 3, 2006
Hi Yasdnil,
Sorry for taking so long to reply.
Have you tried setting a breakpoint in the function f in _actions.js? One thing I did sometimes find was that if this.$edit and this.$active don't have the right values, then f won't call the toggleRows function.
The fragment below from _actions.js shows where those values are checked.
if (this.$active && !this.$edit){
action.call(this, c, r);
}
The other thing to check is that when a row is clicked, the selection mode is multi-row (obj.setSelectionMode("multi-row")) and selection multiple is true (obj.setSelectionMultiple(true))
If you've tried both of these and it still doesn't work, then I'm not sure what else to try.
Helen Williamson
Monday, March 13, 2006
Hi Yasdnil,
Sorry for taking so long to reply.
Have you tried setting a breakpoint within function f in _actions.js? This function actually calls toggleRows. One thing to check is that this.$active and this.$edit have the correct values, otherwise the toggleRows function will not be called.
else {
if (this.$edit){
this.element().focus();
}
if (this.$active && !this.$edit){
action.call(this, c, r);
}
AW.setReturnValue(event, false);
}
action.call(this, c, r) calls toggleRows, but only if this.$active is true and this.$edit is false
The other thing to check is that you've got the right selection mode and selection multiple settings. These are:
obj.setSelectionMode("multi-row");
obj.setSelectionMultiple(true);
Let me know if you get any further.
Helen Williamson
Monday, March 13, 2006
It seems work fine for me. However, it only works after select the sorting index. Without the sorting, it does not work.
flashsnake
Friday, July 28, 2006
This topic is archived.
Back to support forum
Forum search