1

Found the issue on my payment Input control. There was a small computed Text field that was failing but not throwing an error. Just stopped the whole process. In any case removed the computedText and it now works. The compositeData formula that returns pItem to the custom control still fires way to often but I can't figure out how to stop that. It is all memory resident so it is probably not a major performance hit, but still.....

This question is a follow up to my previous question and I will try to refine the issue defining an object property in a compositeData on a custom control

Here is a picture of what I am trying to do: enter image description here

The repeat control is bound to an arrayList generated by the Java method Payments.getAllItems(LinkKey) and that works correctly. The button in the repeat is fairly simple it just setts the viewScope.vsShowPayment = true and vsRIndex to the repeat Index value so I know which element in the ArrayList we are working with. It then does a refresh of the panelPaymentContainer which hides the repeat and renders the custom control ccTestPayment. ccTestPayment has a custom property called pItem of the type java.lang.Object with this code:

<xc:ccTestPaymentInput rendered="#{javascript:(viewScope.vsShowPayment)}">
                <xc:this.pItem><![CDATA[#{javascript:try{
        var debug:Boolean = true;
        if (debug) print("Open existing row = " + viewScope.vsRIndex)
        rIndex = parseInt(viewScope.vsRIndex.toString());
        if (debug) print("rIndex = " + rIndex);
        pItem = Payments.getItem(rIndex);
        return pItem;

}catch(e){
    print("Failure in Custom Prop of add item " + e.toString());
    return null;
}}]]></xc:this.pItem>
</xc:ccTestPaymentInput>

the method in the class Payments Payments.getItem(rIndex) then returns the PaymentItem Object from the ArrayList of PaymentItems and displays them in custom control. the fields in the custom control are bound to compositeData.pItem.getPaymentDate etc and to this point everything is cool.

I can edit any of the fields on the custom control and that all works fine. However, when I press the "Save" button none of the code in it gets executed.

try{
print("Start Payment save");
var debug:Boolean = true;

var pos:Integer = parseInt(viewScope.vsRIndex.toString());
if (debug) print("Working with pos = " +  pos + " Call saveThisItem");

if (Payments.saveThisItem(compositeData.pItem , pos)){
    if (debug) print("save Payments Worked ");
}else{
    if (debug) print("save Payments FAILED ");
}

}catch(e){
    print("payment save Error " + e.tostring);

}finally{
    viewScope.vsExpPayDate = null;
    viewScope.vsShowPayment = false;
    viewScope.remove("vsRIndex");
    viewScope.remove("vsGotItem")
}

None of the print statements get fired. I suspect it has something to do how pItem gets defined. the code behind the custom property gets fired over and over again and I'm wondering if that is getting in the way.

Community
  • 1
  • 1
Bill F
  • 2,057
  • 3
  • 18
  • 39
  • I think I still don't see the whole picture, but as far as I get it your repeated buttons perform a partial refresh on a container which contains both the repeat itself and the CC which in turn has a custom property that you try to change from INSIDE the CC. If so, the repeat, the CC and everything are re-rendered everytime you hit the button resetting everything that is not stored somewhere secure, including the repeat's datasource and most probably also your custom property to their default states and values. – Lothar Mueller Sep 28 '15 at 13:03
  • I see where it can be causing some extra cycles. I'm going to refresh then separately and that should reduce the number of times that it recomputes. Will try a test case to see how much I can reduce the number of cycles. I will post the results later. – Bill F Sep 28 '15 at 22:44

1 Answers1

0

The reason that the save was not working was that there was a computed Text field on the control that generated an error. The problem was that there was no error message reported on the client nor the console. After a lot of head scratching I noticed the text filed was no longer displaying the value it was supposed to. Deleted the field and the save and everything else started to work. On the issue of the number of times the processes are called I think I have resolved many of them. I'm moving the control ccTestPaymentInput.xsp inside the repeat. It will now have direct access to the 'current' PaymentItem Object so I can access teh repeat var=pItem which is teh PaymentItem object I want to work with. Clean and far simpler than what I was doing. The only refreshes necessary are the ones related to the rpeat control and there is not much that I can do about that.

Bill F
  • 2,057
  • 3
  • 18
  • 39