(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. |
|