I confirm that the suggested modification solves the issue.
Thank you,
Thomas
Announcement
Collapse
No announcement yet.
X
-
If you switch on INFO level logging and open up the Developer Console, you should see logs that indicate what the problem is here.
To avoid the behavior you're seeing, setSortByDisplayField(false) on the fields with optionDataSources.
Leave a comment:
-
The problem with showing a SQL DataSource is that we were giving advice for a better approach for SQLDataSource that would avoid this issue entirely, as well as scale and perform better.
We'll still check on this possible bug, but to get good advice, tell us in advance if a test case you're providing doesn't match your real use case.
Leave a comment:
-
Oh, it was just to underline that having the OptionDataSource set on the client side, in our real implementation, has no impact in terms of performance. Nothing else.
For this particular issue, you have 100% of the code required to reproduce the problem, and I did not enable any caching feature on my side.
Leave a comment:
-
You mention client-side caching, what specific mechanism is this? clientOnly DataSource? cacheAllData:true?
Note: it's critical to provide this kind of basic information up front. You've shown us a SQL DataSource when that's apparently not what you're actually using, and because of this all previous commentary was basically a waste of time.
Leave a comment:
-
Thank you.
Yes, if I click the CREATED BY column, the NAME column is sorted, highlighted etc.. exactly like if I clicked on the NAME column. I can "understand" that, as the OptionDataSource points to the same table and the display field is NAME.
I've of course read the documentation, and I'm asking for help here. The Datasource does not seem to like having multiple joins to the same table (with foreignKey and includeFrom) in its definition. If there's a way to do this, well, I did not find it clearly described in the docs. Please also note that (in our real example) the data source is completely cached on the client side.
Thanks,
Thomas
Leave a comment:
-
.. or perhaps you mean that the apparent sort order follows the alphabetical order of the NAME column. But in fact, sorting is being done on the ID values from the createdByField/updatedByField and perhaps this just happens to put the NAME column values in alphabetical order (we can't tell because you didn't share data).Originally posted by Isomorphic View PostSo you must mean that you don't like something in the request you see to the server?
Again, includeFrom is the correct solution here - see the docs.
Leave a comment:
-
What do you mean by "the NAME column is sorted instead"? Certainly, the ListGrid does not switch over to sorting by the field named "NAME", highlight that header, etc. So you must mean that you don't like something in the request you see to the server?
Before answering, first read the docs for ListGridField.optionDataSource, and in particular, the suggestion to use includeFrom for this use case instead.
Leave a comment:
-
Ok thanks! I take note of this best practice.
But, anyway, as I may have expected, it does not change anything. Here is my update code sample, and the problem remains... If I sort on the CREATED_BY or UPDATED_BY columns, the NAME column is sorted instead.
Thanks,Code:ListGrid test = new ListGrid(DataSource.get("test")); test.setWidth(600); test.setHeight(300); test.setAutoFetchData(true); ListGridField idField = new ListGridField("ID"); ListGridField createdField = new ListGridField("CREATED"); ListGridField createdByField = new ListGridField("CREATED_BY"); ListGridField updatedField = new ListGridField("UPDATED"); ListGridField updatedByField = new ListGridField("UPDATED_BY"); ListGridField nameField = new ListGridField("NAME"); createdByField.setOptionDataSource(DataSource.get("test")); createdByField.setValueField("ID"); createdByField.setDisplayField("NAME"); updatedByField.setOptionDataSource(DataSource.get("test")); updatedByField.setValueField("ID"); updatedByField.setDisplayField("NAME"); test.setFields(idField, createdField, createdByField, updatedField, updatedByField, nameField); test.show();
Thomas
Leave a comment:
-
To restate, if you plan to call any setters on your ListGridField instances, call them all before setFields().
Leave a comment:
-
Code:ListGridField id = new ListGridField("ID"); ListGridField c = new ListGridField("CREATED"); ListGridField cb = new ListGridField("CREATED_BY"); cb.setOptionDataSource(DataSource.get("test")); cb.setValueField("ID"); cb.setDisplayField("NAME"); ListGridField u = new ListGridField("UPDATED"); ListGridField ub = new ListGridField("UPDATED_BY"); ub.setOptionDataSource(DataSource.get("test")); ub.setValueField("ID"); ub.setDisplayField("NAME"); ListGridField n = new ListGridField("NAME")); test.setFields(id, c, cb, u, ub, n); test.show();
Leave a comment:
-
What do you mean? I should configure the OptionDataSources (through all the getField() calls) before calling setFields()?
All the information is provided here, not less. Using this, I can reproduce the problem without any additional line of code.
Leave a comment:
-
All right, here is a small test case:
A sample datasource:
Some code:Code:<DataSource ID="test" serverType="sql" tableName="SEC_OPERATOR"> <fields> <field name="ID" type="sequence" primaryKey="true" /> <field name="CREATED" type="creatorTimestamp" /> <field name="CREATED_BY" type="integer" /> <field name="UPDATED" type="modifierTimestamp" /> <field name="UPDATED_BY" type="integer" /> <field name="NAME" type="text" /> </fields> </DataSource>
If I simply click on the CREATED_BY column to sort it, the NAME column gets sorted instead. Same problem if I go to "Configure Sort" dialog.Code:DataSource.load("test", new Function() { @Override public void execute() { ListGrid test = new ListGrid(DataSource.get("test")); test.setWidth(600); test.setHeight(300); test.setAutoFetchData(true); test.setFields( new ListGridField("ID"), new ListGridField("CREATED"), new ListGridField("CREATED_BY"), new ListGridField("UPDATED"), new ListGridField("UPDATED_BY"), new ListGridField("NAME")); test.getField("CREATED_BY").setOptionDataSource(DataSource.get("test")); test.getField("CREATED_BY").setValueField("ID"); test.getField("CREATED_BY").setDisplayField("NAME"); test.getField("UPDATED_BY").setOptionDataSource(DataSource.get("test")); test.getField("UPDATED_BY").setValueField("ID"); test.getField("UPDATED_BY").setDisplayField("NAME"); test.show(); } }, true);
Regards,
Thomas
Leave a comment:
-
Sorry, that's not nearly enough information to enable anyone to help you. Try taking a look at the FAQ to remind yourself of the information you need to post.
Leave a comment:
Leave a comment: