| Summary: | The row of DataGrid can not be selected | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Yu Hao <yuhaodl> | ||||||
| Component: | EDT | Assignee: | Project Inbox <edt.javascriptgen-inbox> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | greer, hjiyong, yuhaodl | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Yu Hao
This is a JSGen Bug. The EGL code in line 1030 of AddClass function in DataGrid.egl is not correctly generated. EGL code: widget.class = widget.class + " " + class; JS Code: widget.setClass(((((egl.checkNull(widget).ezekw$$class) + " ")) + ezekw$$class)); The second widget.class should be generated as widget.getClass(); Created attachment 205087 [details]
Temporary fix
A simpler test case
handler testGetField type RUIhandler{onConstructionFunction = start}
w Widget{class="abc"};
function start()
w.class = w.class + "a";
end
end
Hi Scott,
I attach a fix for this problem, please review.
I change the NamedElementTemplate.genAccessor function
if (((ctx.getAttribute(element, Constants.EXPR_LHS) == null) || (ctx.getAttribute(element, Constants.EXPR_LHS) == Boolean.FALSE)) // return false in this test case
&& (propertyFunction != null) && !CommonUtilities.isCurrentFunction(ctx, propertyFunction)) {
The ctx.getAttribute(element, Constants.EXPR_LHS) is false in this test case. Because when running AssignmentTemplate (line 32), it is put into the context. And the assignment lhs happens to be the same as the LHS of the "+" expression..
I find you the 1st line of this method is
String propertyFunction = CommonUtilities.getPropertyFunction( element, false, ctx );
The second attribute assumes this namedElement is not a setter function. So I remove the if condition to judge if it is namedElement. Is this assumption OK?
With this testcase and my other handlers in my workspace, this fix does not break anything now.
Ji Yong and I reviewed his fix together and concluded that it's incorrect; however, I think he's isolated the problem -- we just need to identify the fix. Another simpler test case
a Widget{};
b Widget{};
function start()
a.x = b.x;
end
The generated js for a.x = b.x is wrong as
this.a.setX(egl.checkNull(this.b).x);
Should be
this.a.setX(egl.checkNull(this.b).getX());
(In reply to comment #5) > Ji Yong and I reviewed his fix together and concluded that it's incorrect; > however, I think he's isolated the problem -- we just need to identify the fix. Scott, The previous fix can resolve this problem. Can you check if it has regression or any side effects. Thanks. Ji Yong, Do you mean the fix in comment #2? I thought we reviewed that and concluded that it would break other things, so as a result you were no longer confident in the change? Or are you talking about a different fix? Created attachment 205678 [details]
Updated patch
(In reply to comment #8) > Ji Yong, > > Do you mean the fix in comment #2? I thought we reviewed that and concluded > that it would break other things, so as a result you were no longer confident > in the change? Or are you talking about a different fix? Sorry, I forgot to attach the patch. Here it is. Have committed the code because many defects are caused by this one. Still need Scott's review. Scott, Please mark this as resolved if you don't see any problem. Thanks. Ji Yong, Reviewed and marking resolved. Thanks! Verified in 201111012101 |