PDA

View Full Version : CellSelectionModel with reorder support - DND



diegolovison
25 Oct 2010, 9:35 AM
package com.example.client.widget.grid;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.grid.CellSelectionModel;

public class XCellSelectionModel<M extends ModelData> extends CellSelectionModel<M> {

@Override
public M getSelectedItem() {

M sel = null;
final CellSelection selectedCell = getSelectCell();

if (selectedCell != null) {
sel = selectedCell.model;
}

return sel;
}

@Override
public List<M> getSelectedItems() {

final List<M> list = new ArrayList<M>();

final M selectedItem = getSelectedItem();
if (selectedItem != null) {
list.add(selectedItem);
}

return new ArrayList<M>(list);
}
}

sven
25 Oct 2010, 9:36 AM
This was already implemented directly in GXT and will be part of GXT 2.2.1