Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Reorder indicator together with drop-move event handler

$
0
0
Hi,
What I need is to display some kind of custom indicator while drop-move event, but still have the build-in record reorder indicator active on ListGrid.
The following example shows that if only any drop-move event handler is added to the grid, then reorder indicator is gone.
When drop-move handler (doing nothing) is commented out, then dot-red reorder indicator is back again.

The question is: Is it possible to define custom drop-move event handler together with build-in reorder indicator?

Code:

package pl.com.tech4.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.DOM;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.events.DropMoveEvent;
import com.smartgwt.client.widgets.events.DropMoveHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;

public class MainEntryPoint implements EntryPoint {
 
    public void onModuleLoad() {

        DOM.getElementById("loadingPicture").removeFromParent();
        layout();
        SC.showConsole();
    }
 
    private void layout() {
     
        DataSource ds = new DataSource();
        DataSourceField fieldId = new DataSourceField();
        fieldId.setName("id");
        fieldId.setPrimaryKey(true);
        fieldId.setHidden(true);
        DataSourceTextField fieldCode = new DataSourceTextField();
        fieldCode.setName("code");
        ds.setFields(fieldId, fieldCode);
     
        ListGrid lg = new ListGrid();
        lg.setDataSource(ds);
        ListGridRecord[] records = new ListGridRecord[2];
        records[0] = new ListGridRecord();
        records[0].setAttribute("id", "1");
        records[0].setAttribute("code", "m/s");
        records[1] = new ListGridRecord();
        records[1].setAttribute("id", "2");
        records[1].setAttribute("code", "knots");
        lg.setData(records);
        lg.setCanReorderRecords(true);
     
        lg.addDropMoveHandler(new DropMoveHandler() {

            public void onDropMove(DropMoveEvent event) {
            }
        });

        lg.draw();
    }
}

Thanks,
MichalG

SmartClient Version: v10.0p_2014-12-27/LGPL Development Only (built 2014-12-27)
Firefox 24.8.0 (Gentoo linux)

Attached Images
File Type: png drop-move and reorder.png (2.6 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles