PDA

View Full Version : When i use EXT.grid.CheckboxSelectionModel, can mutli check anything row click



2pac81
13 Mar 2016, 9:06 PM
hi.
i want company organization tree by use ext js 3.xx.
and i use ext.grid.checkboxselectionmodel. and i want multi check not only checkbox.
i want when i click any row, automatic multi check. but now i only multi check by click checkbox. how can i multi check box by click row.
here is my code..anyone help me.

this.SelectCheck = new Ext.grid.CheckboxSelectionModel({ singleSelect: false });


this.SelectColumn = new Ext.grid.ColumnModel([
this.SelectCheck,
{ header: L_UserJob, dataIndex: 'JobName', menuDisabled: true, width: 90, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserName, dataIndex: 'UserName', menuDisabled: true, width: 140, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserName, dataIndex: 'OrgchartName', menuDisabled: true, width: 180, renderer: this.RendererUserName.createDelegate(this), hidden: false },
{ header: L_UserEmail, dataIndex: 'EmailAddress', menuDisabled: true, width: 160, renderer: this.RendererWithTooltip, hidden: false },
{ header: L_UserCompany, dataIndex: 'CompanyName', menuDisabled: true, width: 90, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserDept, dataIndex: 'DeptName', menuDisabled: true, width: 180, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserDuty, dataIndex: 'DutName', menuDisabled: true, width: 72, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserTitle, dataIndex: 'TitName', menuDisabled: true, width: 77, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserMobile, dataIndex: 'MobileTel', menuDisabled: true, width: 122, renderer: this.RendererWithTooltip, hidden: true },
{ header: L_UserOfficeTel, dataIndex: 'OfficeTel', menuDisabled: true, width: 122, renderer: this.RendererWithTooltip, hidden: true }


]);
this.SelectGridPaging = new Ext.PagingToolbar({
store: this.dsSource, // grid and PagingToolbar using same store
displayInfo: true,
pageSize: OrgChart.SelectGridPageSize,
prependButtons: true
});
this.SelectGridPaging.on('beforechange', function (toolbar, params) {
// default?
var node = this.TreeBox.getSelectionModel().getSelectedNode();
params.mode = 'DeptAll';
if (node != null)
params.query = node.id;
if (toolbar.store.lastOptions) {
var start = params.start;
var limit = params.limit;
Ext.apply(params, toolbar.store.lastOptions.params);
params.start = start;
params.limit = limit;
}
}, this);
this.SelectGrid = new Ext.grid.GridPanel({
region: 'center',
//view: new Ext.grid.GridView({ forceFit: true, enableRowBody: true, emptyText: 'No Record found' }),
view: new Ext.grid.GridView({ enableRowBody: true, emptyText: 'No Record found' }),
margins: '5 5 0 5',
ddGroup: 'srcDDGroup',
enableDragDrop: true,
enableColumnMove: false,
ds: this.dsSource,
cm: this.SelectColumn,
sm: this.SelectCheck,
stripeRows: true,
title: ' ',
bbar: this.SelectGridPaging,
loadMask: { msg: L_WaitMsg },
});

Gary Schlosberg
14 Mar 2016, 3:52 PM
If you're looking to have multiple rows selected, setting singleSelect (http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.grid.CheckboxSelectionModel-cfg-singleSelect) to false (as you've done) should do that. If you'd like to have selection by row as well as checkbox, you should configure checkOnly (http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.grid.CheckboxSelectionModel-cfg-checkOnly) to false (which should already be the case as it is the default). Does that not work for you?

2pac81
14 Mar 2016, 5:14 PM
hi..already also setting singleselect : false and checkonly : false .
but not woking..only when i use drag&drop , multi select working.

when i click one row, single selected. and then i click other row,
before selected row unchecked and other row checked.
when i click checkbx, multi selected.
when i dra&drop the rows, multi seleted.

Gary Schlosberg
4 Apr 2016, 3:56 PM
Not sure why that would be. Can you reproduce in a runnable test case?
https://fiddle.sencha.com/#home