Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@93544 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-26 10:04:01 +00:00 committed by Giancarlo Panichi
parent 5c439a7c3d
commit 69078a132b
1 changed files with 37 additions and 0 deletions

View File

@ -56,6 +56,7 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.HeaderContextMenuEvent;
import com.sencha.gxt.widget.core.client.event.HeaderContextMenuEvent.HeaderContextMenuHandler;
import com.sencha.gxt.widget.core.client.grid.CellSelectionModel;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
@ -64,6 +65,7 @@ import com.sencha.gxt.widget.core.client.grid.LiveToolItem;
import com.sencha.gxt.widget.core.client.menu.Item;
import com.sencha.gxt.widget.core.client.menu.Menu;
import com.sencha.gxt.widget.core.client.menu.MenuItem;
import com.sencha.gxt.widget.core.client.selection.CellSelection;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
@ -212,6 +214,40 @@ public class TabularDataXGridPanel extends ContentPanel {
return null;
}
/**
* Retrieve selected cell value
*
* @return
*/
public String getSelectedCell() {
if (grid != null && grid.getSelectionModel() != null) {
CellSelection<DataRow> cell=((CellSelectionModel<DataRow>)grid.getSelectionModel()).getSelectCell();
DataRow dataRow=cell.getModel();
Row row=new Row(dataRow, keys);
ColumnModel<DataRow> columnModel = grid
.getColumnModel();
List<ColumnConfig<DataRow, ?>> columns = columnModel
.getColumns();
ColumnConfig<DataRow, ?> col=columns.get(cell.getCell());
DataRowColumnConfig<?> c = (DataRowColumnConfig<?>) col;
ColumnDefinition cd = c.getDefinition();
String rowS = row.getFieldAsText(cd.getLabel());
String cellS="Selected Cell: ["+cell.getRow()+", "+cell.getCell()+"] "+rowS;
Log.debug(cellS);
return rowS;
}
return null;
}
/**
* getSelectedRowsId
*
@ -374,6 +410,7 @@ public class TabularDataXGridPanel extends ContentPanel {
//liveGridView.setRowHeight(19);
grid = new Grid<DataRow>(store, columnModel);
grid.setSelectionModel(new CellSelectionModel<DataRow>());
grid.setLoadMask(true);
grid.setLoader(loader);
grid.setView(liveGridView);