PDA

View Full Version : [CLOSED] [4.2.0] Checkbox selection model should not force Simple mode for checker column



Daniil
8 Apr 2013, 8:51 PM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.0

Browser versions tested against:

Any

DOCTYPE tested against:

Any

Description:

Currently, a Checkbox selection model forces Simple mode for the checker column.

Ext.selection.CheckboxModel processSelection

processSelection: function (view, record, item, index, e) {
var me = this,
checker = e.getTarget(me.checkSelector),
mode;

// checkOnly set, but we didn't click on a checker.
if (me.checkOnly && !checker) {
return;
}

if (checker) {
mode = me.getSelectionMode();
// don't change the mode if it's single otherwise
// we would get multiple selection
if (mode !== 'SINGLE') {
me.setSelectionMode('SIMPLE');
}
me.selectWithEvent(record, e);
me.setSelectionMode(mode);
} else {
me.selectWithEvent(record, e);
}
}


Agree, it is convenient to have Simple mode for the checker column, but it should be, at least, configurable. Setting up mode to Multi explicitly I would expect the same clicking on a checkbox or a row.


Steps to reproduce the problem:

Click two rows
Click two checkboxes

The result that was expected:

The different result: one selected row VS two ones.

The result that occurs instead:

The same results

Test Case:


<!DOCTYPE html>
<html>
<head>
<title>Checkbox selection model should not force Simple mode for checker column</title>

<link rel="stylesheet" href="../resources/css/ext-all.css" />

<script src="../ext-all-debug.js"></script>

<script>
Ext.onReady(function () {
Ext.create("Ext.grid.Panel", {
renderTo: Ext.getBody(),
store: {
fields: [{
name: "test1"
}, {
name: "test2"
}, {
name: "test3"
}],
data: [{
test1: "1",
test2: "2",
test3: "3"
},
{
test1: "4",
test2: "5",
test3: "6"
}, {
test1: "7",
test2: "8",
test3: "9"
}]
},
columns: [{
text: "Test1",
dataIndex: "test1"
}, {
text: "Test2",
dataIndex: "test2"
}, {
text: "Test3",
dataIndex: "test3"
}],
selType: "checkboxmodel",
selModel: {
mode: "MULTI"
}
});
});
</script>
</head>
<body>

</body>
</html>

slemmon
8 Apr 2013, 10:06 PM
Thanks for the report! I have opened a bug in our bug tracker.