Announcement

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

    List Grid multilevel sorting problem

    Hi,

    I want to use multilevel sorting in ListGrid. I am writing following code for this but while running application and clicking on MultiLevel Sort button I am getting this exception. Please help me for this.

    code:

    positionGrid.setCanMultiSort(true);
    positionGrid.setDataSource(DataSource.get("positionView"));

    IButton sortButton = new IButton("Multilevel Sort");
    sortButton.setWidth(120);
    sortButton.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {

    try {
    MultiSortDialog.askForSort(positionGrid, positionGrid.getSort(), new MultiSortCallback() {

    @Override
    public void execute(SortSpecifier[] sortLevels) {
    if(sortLevels != null) {
    positionGrid.setSort(sortLevels);
    }

    }
    });
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    });

    Exception:
    com.google.gwt.core.client.JavaScriptException: (TypeError): self.getSort is not a function
    fileName: http://localhost:8888
    lineNumber: 1594
    stack: ()@http://localhost:8888:1594
    @:0
    ([object GWTJavaObject],131220,[object GWTJavaObject])@http://localhost:8888/cmps_pw/hosted.html?cmps_pw:56
    ([object Object],(void 0))@http://localhost:8888:1826
    ([object Object],(void 0))@http://localhost:8888/cmps_pw/sc/modules/ISC_Foundation.js:308
    ([object Object],(void 0))@http://localhost:8888/cmps_pw/sc/modules/ISC_Foundation.js:310
    ([object Object],"click")@http://localhost:8888/cmps_pw/sc/modules/ISC_Core.js:1446
    ([object Object])@http://localhost:8888/cmps_pw/sc/modules/ISC_Core.js:1307
    ([object MouseEvent],(void 0))@http://localhost:8888/cmps_pw/sc/modules/ISC_Core.js:1294
    ([object MouseEvent])@http://localhost:8888/cmps_pw/sc/modules/ISC_Core.js:1285
    ((function (_1, _2) {var _3 = isc.EH;if (isc.Browser.isIE && !_3.$j6) {var _4 = _3.lastEvent;_4.eventType = _3.MOUSE_DOWN;_3.handleMouseDown(null, _3.lastEvent);}if (!_2) {_3.$ku = true;}var _5 = _3.$k5(_1, _2);_3.$ku = false;if (isc.Browser.isSafari) {_5 = true;}return _5;}),[object MouseEvent])@http://localhost:8888/cmps_pw/sc/modules/ISC_Core.js:1506
    anonymous([object MouseEvent])@http://localhost:8888/cmps_pw/sc/modules/ISC_Core.js:54

    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.smartgwt.client.widgets.grid.ListGrid.getSort(ListGrid.java)
    at com.smartgwt.pw.client.CenterStack$2.onClick(CenterStack.java:181)
    at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:97)
    at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    at java.lang.Thread.run(Thread.java:619)

    #2
    This is working for us. Here's our complete test case.
    Can you verify you're running against the latest nightly build?

    Code:
    	public void onModuleLoad() {
    
    		final ListGrid positionGrid = new ListGrid();
    		DataSource pView = new DataSource();
    		pView.setClientOnly(true);
    		pView.setID("positionView");
    		
    		DataSourceField f1= new DataSourceField("f1", FieldType.INTEGER);
    		DataSourceField f2 = new DataSourceField("f2", FieldType.INTEGER);
    		pView.setFields(f1,f2);
    		
    		ListGridRecord r1 = new ListGridRecord();
    		r1.setAttribute("f1", 0);
    		r1.setAttribute("f2", 100);
    		
    		ListGridRecord r2 = new ListGridRecord();
    		r2.setAttribute("f1", 100);
    		r2.setAttribute("f2", 0);
    		
    		ListGridRecord r3 = new ListGridRecord();
    		r3.setAttribute("f1", 100);
    		r3.setAttribute("f2", 100);
    		
    		Record[] testD = new Record[] {r1,r2,r3};
    		
    		pView.setTestData(testD);
    		
    		positionGrid.setCanMultiSort(true);
    		positionGrid.setDataSource(pView);
    		positionGrid.setAutoFetchData(true);
    		
    		IButton sortButton = new IButton("Multilevel Sort");
    		sortButton.setWidth(120);
    		sortButton.addClickHandler(new ClickHandler() {
    		public void onClick(ClickEvent event) {
    
    		try {
    			MultiSortDialog.askForSort(positionGrid, positionGrid.getSort(), new MultiSortCallback() {
    	
    				@Override
    				public void execute(SortSpecifier[] sortLevels) {
    					if(sortLevels != null) {
    						positionGrid.setSort(sortLevels);
    					}
    		
    				}
    			});
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		}
    		});
    		
    		VLayout layout = new VLayout();
    		layout.setWidth100();
    		layout.setHeight100();
    		layout.setMembers(positionGrid,sortButton);
    		layout.draw();
    	}

    Comment

    Working...
    X