Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020324Openbravo ERPA. Platformpublic2012-04-23 00:512012-05-13 20:51
mtaal 
mtaal 
normalminorhave not tried
closedfixed 
5
 
3.0MP12 
No
Core
No
0020324: [SC Upgrade] click on column header does not change sorting
When clicking multiple times on a column header then the sorting is not changed from asc to desc or vice versa.
This only seems to happen for foreign key columns.

Changing the sort direction through the column header context menu works.
1) goto sales order window
2) header tab
3) click several times on the business partner column header
4) notice that the first time the sorting is done, but after that the sort direction does not change
No tags attached.
Issue History
2012-04-23 00:51mtaalNew Issue
2012-04-23 00:51mtaalAssigned To => dbaz
2012-04-23 00:51mtaalModules => Core
2012-04-23 00:51mtaalOBNetwork customer => No
2012-04-24 20:41dbazTypedefect => design defect
2012-04-26 17:15mtaalNote Added: 0048050
2012-04-26 17:22mtaalNote Added: 0048055
2012-04-26 17:27mtaalAssigned Todbaz => mtaal
2012-05-13 20:50mtaalStatusnew => scheduled
2012-05-13 20:50mtaalNote Added: 0048595
2012-05-13 20:50mtaalfix_in_branch => pi
2012-05-13 20:50mtaalNote Added: 0048596
2012-05-13 20:50mtaalStatusscheduled => resolved
2012-05-13 20:50mtaalFixed in Version => 3.0MP12
2012-05-13 20:50mtaalFixed in SCM revision => .
2012-05-13 20:50mtaalResolutionopen => fixed
2012-05-13 20:51mtaalNote Added: 0048597
2012-05-13 20:51mtaalStatusresolved => closed

Notes
(0048050)
mtaal   
2012-04-26 17:15   
Analysis by David:



I have debugged it and I found why it crashes, but not been able to fix it. I am going to explain you my progress just to avoid you the initial pain:

The problem is in Smartclient isomorphic/client/widgets/ListGrid.js in function "setSort"
I am going to focus in "Sales Order" -> "Organization" column

There is a "sortSpecifiers" array. For this case, the first time you click the column, "sortSpecifiers.property" is "organization" and the next times is "organization$_identifier"

With this, at line 35516 it does a
  field = this.getUnderlyingField(item.property), --> item.property ==== sortSpecifiers.property for this particular column, so "organization$_identifier" the second time you click it

This "getUnderlyingField" tries to get a
item = isc.Class.getArrayItem(fieldId, this.fields, this.fieldIdProperty);
being "fieldIdProperty" === "name" (string).
Since "name" in the column array is just "organization" it doesn't return anything, because we are passing "organization$_identifier", so the previous said "field" variable is null

Then, it uses this "field" value inside an if statement to do more things.

Until here, the behavior is the same in Smartclient 8.1 and 8.3. In both cases the second click has a null "field" variable value. The point is that this "setSort" column in 8.1 continues doing another things with the "sortSpecifiers" and at the end it obtains the correct result.

In 8.3, after the if statement involving the "field" variable, in line 35573 it does
  this._sortSpecifiers = newSpecifiers;
and this "newSpecifiers" is obtained inside the "field" if statement, so from here, in 8.3, "this._sortSpecifiers" is null and it can not obtain things.

If you just replace this line with "this._sortSpecifiers = sortSpecifiers || [];", what is at the end what has been done in 8.1 (although in this case it is being done some lines before), the thing works ok.


So the "easy" solution from our side could be ensure this "sortSpecifiers.property" be just "organization" instead of "organization$_identifier".

If it is not possible, we should ask Smartclient why are they doing that: have an if statement just if "fields" exists, and then base the rest of the function code in things that have been obtained inside this if statement.
(0048055)
mtaal   
2012-04-26 17:22   
Asked on the smartclient forum:
http://forums.smartclient.com/showthread.php?p=85461#post85461 [^]
(0048595)
mtaal   
2012-05-13 20:50   
.
(0048596)
mtaal   
2012-05-13 20:50   
Fixed through smartclient upgrade
(0048597)
mtaal   
2012-05-13 20:51   
Works