Working with GXT and using a checkbox selection model. I notice that when every row is checked, the checkbox header will also be checked, but the checkbox header has no functionality of its own.
How can I tell the checkbox header to select/unselect all checker rows when clicked?
Thanks for the help!
You need to add the selection model as a plugin to the grid.
grid.addPlugin(sm);
You will need to set the selection model on the grid directly.
identityProvider = new IdentityValueProvider<DataModelProxy>();
checkboxSelectionModel = new CheckBoxSelectionModel<DataModelProxy>(identityProvider);
checkboxSelectionModel.setSelectionMode(SelectionMode.MULTI);
grid.setSelectionModel(checkboxSelectionModel);
where DataModel is your datamodel and proxy of this model.
Related
I am new to Nattable, my requirement is to highlight a selected object of nattable view to different view.
Consider 'View1' as nattable data view, it has following code:
getViewSite().setSelectionProvider(
m_gridTable.getRowSelectionProvider() );
and 'View2' implements ISelectionListener, but 'selectionChanged' of View2 is not getting called when I select any object in 'View1'.
Am I missing anything?
RowSelectionProvider was created using fullySelectedRowsOnly as true value so selection event was not fired unless user selects complete row, changing flag to false worked fine for me.
I am using DOJO datagrid version 1.10 What I want is on tab indexing the row in the grid should get highlighted so that user will be able to know on which row the focus is. But I am not getting the row focus.
You could listen on the dojox.grid.DataGrid::onCellFocus event. The event arguments are the focused cell-Object itself and the corresponding rowIndex.
function onCellFocus(cell, rowIndex) {
// first clear selection
grid.selection.clear();
// select the focused row
grid.selection.setSelected(rowIndex, true);
// invoke manually the render method
grid.render();
}
I've created a working fiddle for you, which can be found here.
I want to add a combobox in my grid, which would populate its store(of grid) as user provide the word.
If i am adding a custom abstract cell in to grid, I can able to add combobox as edittor to it. But when i am trying to use combobox cell (need to display text in a input tag/ Editable), Combobox is not adding to Grid.
Mean to say when I click on that column, it's not converting to combobox.
Tried with adding keyuphandler to addHandler method. But It's not coming to that handler.
i have an combobox in a gridcolumn and the requirment is to show only nonselected values in the dropdown list for the next combo selection
One possibility is to use the superselectbox. If you want to customize the standard combobox, you can take a look at the superselectbox source code - it is actually extended combobox.
I'm breaking my head since a whole day now but cannot find a solution, I hope someone can help me.
I'm trying to create a simple SmartGWT ListGrid with checkboxes and for some reason I can only check checkboxes but not uncheck them.
Once the checkbok is checked there is no way to uncheck it.
Below the code I'm using to create the grid.
Here I first instantiate the grid that is populated later with a call to the server.
Any idea of what I'm doing wrong? Anything wrong with the initialisation maybe?
Thanks in advance!!
[...]
ListGrid hotelsGrid = new ListGrid();
hotelsGrid.enableHiliting(false);
hotelsGrid.setCanSort(false);
hotelsGrid.setCanResizeFields(false);
hotelsGrid.setShowHeader(false);
hotelsGrid.setAutoFitData(Autofit.BOTH);
hotelsGrid.setStyleName("selectGrid");
hotelsGrid.setCanEdit(false);
hotelsGrid.setShowHover(false);
hotelsGrid.setShowRollOver(false);
hotelsGrid.setShowSelectedStyle(false);
hotelsGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
[...]
private void initGrid(String[] sParams){
ListGridField flagField = new ListGridField("flagField", "Status", 40);
flagField.setAlign(Alignment.CENTER);
flagField.setType(ListGridFieldType.IMAGE);
flagField.setImageURLPrefix("flags/");
flagField.setImageURLSuffix(".png");
ListGridField textField = new ListGridField("textField", "Meaning");
hotelsGrid.setFields(flagField, textField);
hotelsGrid.setData(getSelectRecords(sParams));
}
It's not clear how your code sample above is related to a clickable checkbox - your code doesn't make any attempt to create a field with checkboxes??
All you need to do to get a clickable checkbox is declare a field of type "boolean" and setCanToggle(true). setCanToggle(true) allows it to be toggled with one click without needing to have editing enabled for any other fields.