This discussion is archived
8 Replies Latest reply: Nov 20, 2003 6:45 AM by 405015 RSS

UIX: PrimaryClientAction

405015 Newbie
Currently Being Moderated
I have a uix choice component that uses a primary client action. Here is the method that handles the fired action:

public static EventResult fminstEventHandler(BajaContext context,Page page,PageEvent event) throws Throwable
{
.
.
.
ApplicationModule deptAppModule = Configuration.createRootApplicationModule("mypackage1.DeptAppModule","DeptAppModuleLocal");

ViewObject deptview = deptAppModule.findViewObject("DeptView1");

deptview.setWhereClause(null);

deptview.setWhereClause("inst='" + fmInstNum +"' and dept!='*****' and guide_yr='"+guideyr +"'");

deptview.executeQuery();

return new EventResult(page);
}

So my question is: I changed my view object and refreshed the resultset by calling executeQuery(), now how do I refresh the uix page to reflect the new viewobjects result set.

I think returning "new EventResult(page)" is correct, but I think I am missing a step here somewhere. I can't get the new UIX choice component to reflect the new resultset.
  • 1. Re: UIX: PrimaryClientAction
    405015 Newbie
    Currently Being Moderated
    Here is my UIX code:

    <rawText text="From Institution ">
    <contents>
    <choice model="${data.TransferGuideUIModel.Name}"
    name="FmName" prompt="FmName">
    <primaryClientAction>
    <firePartialAction event="FmInstEvent"
    formSubmitted="true"
    targets="Department"/>
    </primaryClientAction>
    <contents
    childData="${data.TransferGuideUIModel.Name.displayData}">
    <option model="${uix.current}"
    text="${uix.current.prompt}"
    value="${uix.current.prompt}"/>
    </contents>
    </choice>
    </contents>
    </rawText>


    Thanks :)
  • 2. Re: UIX: PrimaryClientAction
    101342 Newbie
    Currently Being Moderated
    The "targets" list of IDs on <primaryClientAction> should be pointing at the IDs of the components that need to get refreshed. In your example, you've got one ID - "Department". Is there a component with that ID in your page?

    BTW, "return null;" is equivalent to (and less typing than) "return new EventResult(page);". Both are correct - your EventHandler looks fine.
  • 3. Re: UIX: PrimaryClientAction
    101342 Newbie
    Currently Being Moderated
    Oops, I should have said "targets" on <firePartialAction>, not <primaryClientAction>...

    Anyway, it can sometimes be hard to tell when <firePartialAction> isn't working if its because the wrong parts of the page are getting updated, or because your event handler isn't properly updating the page state. So, a quick piece of debugging advice: fire up Netscape 4 (yes, that ancient version!), and use that to run your page. We'll automatically disable PPR, so the entire page will refresh. If the correct state still doesn't appear, then the problem is in your EventHandler and how it's calling BC4J. If the correct state does appear in Netscape 4, then your EventHandler's perfect, and something else is going wrong (like "targets" isn't pointing at the right thing.)
  • 4. Re: UIX: PrimaryClientAction
    405015 Newbie
    Currently Being Moderated
    Thanks for your help.

    Okay in Netscape it does refresh the page, but my uix choice boxes are not repopulated with the new values. It must be a problem with my eventhandler. Any suggestions?

    Thanks
  • 5. Re: UIX: PrimaryClientAction
    101342 Newbie
    Currently Being Moderated
    When you say "my choice boxes aren't repopulated", do you mean, the "Department" choice boxes, or the ones in the snippet you showed me? I'm confused here, because the snippet I see only has the source of the PPR event, but not the target.
  • 6. Re: UIX: PrimaryClientAction
    405015 Newbie
    Currently Being Moderated
    Thanks again for your help. Sorry for the ambiguity. The choice boxes that aren't getting repopulated is the Department choice box. Here is the code for the UIX portion. I hope this clears up some confusion.

    &lt;!-- FmName --&gt;
    &lt;rawText text="From Institution "&gt;
    &lt;contents&gt;
    &lt;choice model="${data.TransferGuideUIModel.Name}"
    name="FmName" prompt="FmName"&gt;
    &lt;primaryClientAction&gt;
    &lt;firePartialAction event="FmInstEvent"
    formSubmitted="true"
    targets="Department"/&gt;
    &lt;/primaryClientAction&gt;
    &lt;contents
    childData="${data.TransferGuideUIModel.Name.displayData}"&gt;
    &lt;option model="${uix.current}"
    text="${uix.current.prompt}"
    value="${uix.current.prompt}"/&gt;
    &lt;/contents&gt;
    &lt;/choice&gt;
    &lt;/contents&gt;
    &lt;/rawText&gt;
    &lt;!-- Dept --&gt;
    &lt;rawText text="From Department "&gt;
    &lt;contents&gt;
    &lt;choice model="${data.TransferGuideUIModel.Dept}" name="Dept" prompt="Dept"&gt;
    &lt;contents childData="${data.TransferGuideUIModel.Dept.displayData}"&gt;
    &lt;option model="${uix.current}"/&gt;
    &lt;/contents&gt;
    &lt;/choice&gt;
    &lt;/contents&gt;
    &lt;/rawText&gt;
  • 7. Re: UIX: PrimaryClientAction
    101342 Newbie
    Currently Being Moderated
    The "targets" attribute of <firePartialAction> has to be a list of IDs on the page. I don't see a "Department" ID anywhere, so that's causing a serious problem with the PPR side of things. You need to set "id" to Department on the appropriate component.

    For why "Dept" isn't getting repopulated even without PPR, this looks like exactly the same issue as what you brought up in another thread:
    UIX choice component event handling

    BTW, it's not clear why you're using <rawText> here; plain old <styledText> (without any <contents> either) would be much more straightforward:
      <styledText text="From Institution"/>
      <choice ...>...</choice>
  • 8. Re: UIX: PrimaryClientAction
    405015 Newbie
    Currently Being Moderated
    Thank you for your help. Found a resolution.