Announcement

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

    OnGroupByComplete is not getting called

    Browser: Firefox 52.0
    Smartgwt : Version 6.1p, Built 2017-09-05
    GWT: 2.7

    I need to be able to capture when the grouping is finished but it isn't getting invoked. Below are the code snippets.

    The json response that is returned is
    {"response" : {
    "status":0,
    "startRow":0,
    "endRow":50,
    "totalRows":50,
    "internalCnt":0,
    "data" : [{"name": "name0", "id":"0"}, ....and so on ]
    }
    }

    MyProject.java

    public class MyProject implements EntryPoint {

    ListGrid grid = null;

    public void onModuleLoad() {
    VLayout mainContainer = new VLayout();
    mainContainer.setWidth(800);
    mainContainer.setHeight(500);
    mainContainer.addMember(buildListGrid());
    RootPanel.get("mainContainer").add(mainContainer);
    fetchData();
    }


    private ListGrid biuldListGrid() {
    grid = new ListGrid();
    ListGridField name = new ListGridField("name", "Name");
    ListGridField id = new ListGridField("id", "ID", 100);

    grid.setFields(id, name);
    MyDS ds = new MyDS("id");
    grid.setDataSource(ds);
    grid.setGroupStartOpen(GroupStartOpen.ALL);
    grid.groupBy("name");
    grid.setHeight(400);

    grid.addGroupByCompleteHandler(new GroupByCompleteHandler() {
    @Override
    public void onGroupByComplete(GroupByCompleteEvent event) {
    SC.say("in group by complete handler");
    }

    });
    }

    protectred void fetchData() {
    grid.fetchData(new Criteria(), new DSCallback() {
    @Override
    public void execute(DSResponse response, Object rawData, DSRequest request) {
    selectEntry();
    }
    }
    }

    protected void selectEntry() {
    int index = grid.getGroupTree().findIndex("id", "10");
    grid.selectRange(index, index+1);
    }

    }

    public class MyDS extends RestDataSource {
    public MyDS() {
    this("myds");
    }

    public MyDS(String id) {
    setID(id);
    setClientOnly(false);
    setDataFormat(DSDataFormat.JSON);
    setJsonPrefix("");
    setJsonSuffix("");
    OperationBinding fetch = new OperationBinding();
    fetch.setOperationType(DSOperationType.FETCH);
    DSRequest fetchProps = new DSRequest();
    fetchProps.setHttpMethod("GET");
    fetch.setRequestProperties(fetchProps);

    setOperationBindings(fetch);

    init();
    }

    protected void init() {
    DataSourceField id = new DataSourceField("id", "ID");
    id.setPrimaryKey(true);
    id.setHidden(true);
    DataSourceField name = new DataSourceTextField("name", "Name");

    setFields(id, name);
    }
    }

    I create the data as follows on my Server:

    public List<MyData> createDummyData() {
    List<MyData> data = new ArrayList<MyData>();
    int cnt = 51;
    int skip = 0;
    String name = "name"+0;

    for (int i=0; i<cnt; i++) {
    MyData d = new MyData();
    if (skip > 2) {
    name = "name" + i;
    skip = 0;
    }

    skip++;
    d.setId(i+"");
    d.setName(name);
    data.add(d);
    }

    return data;

    }

    public class MyData {

    private String id;
    private String name;

    public String getId() {
    return id;
    }

    public void setId(String id) {
    this.id = id;
    }
    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }



    }

    #2
    This appears to be a duplicate of an issue you have already posted in another thread. Please be careful to never do this again, as this created duplicated work, to the detriment of the entire community.

    Comment


      #3
      I didn't consider it a duplicate since it is a different issue. The other issue is selecting an item in a groupby isn't working. The solution proposed to that post was to capture onGroupBy event. I tried this and it failed. So I thought this was a different issue. Neverthess...I still don't have an answer on why the gorupby event is not getting invoked. If that works I'm assuming my other issue can be resolved as well.

      Comment


        #4
        If you are going to repost an issue that you raised in another thread, link the two threads. Otherwise, again, it looks like a new issue and you will cause duplicated work.

        We're still working on the other thread.

        Comment


          #5
          My appologies for duplicate ticket. I erroneously thought these were considered two different issues. Linked them as requested. Thanks so much for your help!
          Browser: Firefox 52.0 Smartgwt : Version 6.1p, Built 2017-09-05 GWT: 2.7 I am trying to select a listgrid record that has been grouped. I use the

          Comment


            #6
            Any progress on this?

            Comment

            Working...
            X