Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid single selection mode not always applied

    Hi,

    I'm using SmartGWT 4.0p and I encountered the following problem. My ListGrid has been configured to work in 'Single Selection' mode. However, when I call selectRecord(record) the selection is added to the current selection, which is inconsistent ... IMO, the current selection should be discarded (and an event fired), then the specified record should be selected.

    Here is a small example which illustrates the problem and a screenshot:

    Code:
    final ListGrid test = new ListGrid(DataSource.get("sys_configuration"));
    test.setSelectionType(SelectionStyle.SINGLE);
    test.setAutoFetchData(true);
    test.setWidth100();
    test.setHeight100();
    test.addDataArrivedHandler(new DataArrivedHandler() {
    			
    	@Override
    	public void onDataArrived(DataArrivedEvent event) {
    		test.selectRecord(0);
    		test.selectRecord(1); // this one should force record 0 to be unselected
    	}
    });
    test.draw();
    Thanks,


    Edit:
    I found that I should use selectSingleRecord(record) instead. So it's ok for me! But again for consitency, I would perhaps advise to redirect the selectRecord() call to selectSingleRecord() when the selection type is set to Single :-).
    Thanks Anyway !

    Thomas
    Attached Files
    Last edited by tgilbert; 22 Oct 2013, 01:12.

    #2
    To get what you want call selectSingleRecord().

    Comment

    Working...
    X