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

How to disable sorting when setGroupByField() feature is used

$
0
0
I want to preserve the data record order when showing the data set by group. I tried to use setCanSort(false), setCanMultiSort(false) and setSortField(null) but nothing worked.

See more details below:

1. the *complete* SmartGWT or SmartClient version

SmartClient Version: v9.0p_2013-08-27/PowerEdition Deployment (built 2013-08-27)

2. browser(s) and version(s) involved
FF 17.0.9

3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
N/A

4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
N/A

5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
N/A

6. sample code if applicable

{
mObjectDataSource = new RestDataSource() ;

mObjectDataSource.setDataFormat(DSDataFormat.JSON);

DataSourceTextField typeField = new DataSourceTextField(
OBJECT_TYPE, "Type");
DataSourceTextField nameField = new DataSourceTextField(
OBJECT_NAME, "Name");
mObjectDataSource.setFields(typeField, nameField);

mObjectDataSource
.setFetchDataURL("http://127.0.0.1:8888/data/objects.js");

ListGridField objectNameField = new ListGridField(OBJECT_NAME);

objectNameField.setCanSort(false);
setCanSort(false);
setCanMultiSort(false);

setFields(objectNameField);
setGroupStartOpen(GroupStartOpen.ALL);
setGroupByField(OBJECT_TYPE);

setShowAllRecords(true);
setShowHeader(false);
setSelectionType(SelectionStyle.NONE);

setAutoFetchData(true);
setDataSource(mObjectDataSource);
}

JSON data source:
{
"response": {
"status": 0,
"startRow": 0,
"endRow": 9,
"totalRows": 10,
"data": [
{"type": "type1", "name": "object1"},
{"type": "type1", "name": "object2"},
{"type": "type1", "name": "object3"},
{"type": "type1", "name": "object4"},
{"type": "type1", "name": "(more)"},
{"type": "type2", "name": "object8"},
{"type": "type2", "name": "object7"},
{"type": "type2", "name": "object6"},
{"type": "type2", "name": "object5"},
{"type": "type2", "name": "(more)"}
]
}
}

Viewing all articles
Browse latest Browse all 4756

Trending Articles