• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[RESOLVED] Rép : Re: Rép : Re: Cascade autoCompletion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RESOLVED] Rép : Re: Rép : Re: Cascade autoCompletion


  • Subject: [RESOLVED] Rép : Re: Rép : Re: Cascade autoCompletion
  • From: Raymond NANEON <email@hidden>
  • Date: Fri, 25 Nov 2011 10:15:09 +0000 (GMT)

Paul,

I found it. I tested all bindings of AjaxObservedField and I found this attribute "observeDelay" (the minimum time between submits (in seconds)).
I added it to my AjaxObservedField and put 0.2 second value and it work fine. My selectedValue have time to instanciate and get the value of autoCompletion selection.

Thanks for all.

Here are codes

//html
<webobject name = "completionForm">
  <table cellspacing = "0" cellpadding = "3" border = "0" bordercolor = "#00AE14" id = "modRec">
    <tr>
      <td class = "texte">&nbsp;Module de recherche mots clefs&nbsp;:</td>
      <td class = "texte">
        <div id = "searchForm">
          <webobject name = "completionAof"><webobject name = "completion" /></webobject>&nbsp;
        </div>
      </td>
      <td class = "texte">
        <div id = "searchForm">
          <webobject name = "completionAof1"><webobject name = "completion1" /></webobject>
        </div>
      </td>
      <td class = "texte">
        <div id = "searchForm">
          <webobject name = "completionAof2"><webobject name = "completion2" /></webobject>
        </div>
      </td>
    </tr>
  </table>
</webobject>


//WOD
completionForm : WOForm {
   
}

completionAof : AjaxObserveField {
    id="span1";
    fullSubmit = true;
    elementName = "span";
    action = "">    observeDelay = "0.2";
}

completion : AjaxAutoComplete {
    list = currentsKeywords;
    value = wordValue;
    item = currentKeyword;
    displayString = currentKeyword.refidxval;
    selection = selectKeyword;
}

completionAof1 : AjaxObserveField {
    id="span2";
    fullSubmit = true;
    elementName = "span";
    action = "">    observeDelay = "0.2";
}

completion1 : AjaxAutoComplete {
    list = currentsKeywords1;
    value = wordValue1;
    item = currentKeyword1;
    displayString = currentKeyword1.refidxval;
    selection = selectKeyword1;
}

completionAof2 : AjaxObserveField {
    id="span3";
    fullSubmit = true;
    elementName = "span";
    action = "">    observeDelay = "0.2";
}

completion2 : AjaxAutoComplete {
    list = currentsKeywords2;
    value = wordValue2;
    item = currentKeyword2;
    displayString = currentKeyword2.refidxval;
    selection = selectKeyword2;
}

//Java
//master completion
    public NSArray<EORefidx> allKeywords;
    public EORefidx currentKeyword;
    public EORefidx selectKeyword;
    public String wordValue;
    //satellite completion1
    public NSArray<EORefidx> allKeywords1;
    public EORefidx currentKeyword1;
    public EORefidx selectKeyword1;
    public String wordValue1;
    //satellite completion2
    public NSArray<EORefidx> allKeywords2;
    public EORefidx currentKeyword2;
    public EORefidx selectKeyword2;
    public String wordValue2;

    public AutoCompletion(WOContext context) {
        super(context);
        allKeywords = EORefidx.fetchGetMotsClefsParents(session().defaultEditingContext());
    }
   
    //master completion
    public NSArray<EORefidx> currentsKeywords(String value){
        NSArray<EORefidx> result = new NSArray<EORefidx>();
        result = EORefidx.REFIDXVAL.containsAll(value).filtered(allKeywords);
        return result;
    }
   
    public NSArray<EORefidx> currentsKeywords(){
        return currentsKeywords(wordValue);
    }
   
    public WOActionResults submitted() {
        System.out.println("AutoComplete.submitted: " + wordValue + ", " + selectKeyword);
        allKeywords1 = EORefidx.fetchGetMotClefs(session().defaultEditingContext(),Integer.valueOf(selectKeyword.primaryKey()));
        return null;
    }
    //End master completion
   
    //satellite completion1
    public NSArray<EORefidx> currentsKeywords1(String value){
        NSArray<EORefidx> result = new NSArray<EORefidx>();
        result = EORefidx.REFIDXVAL.containsAll(value).filtered(allKeywords1);
        return result;
    }
   
    public NSArray<EORefidx> currentsKeywords1(){
        return currentsKeywords1(wordValue1);
    }
   
    public WOActionResults submitted1() {
        System.out.println("AutoComplete1.submitted: " + wordValue1 + ", " + selectKeyword1);
        allKeywords2 = EORefidx.fetchGetMotClefs(session().defaultEditingContext(),Integer.valueOf(selectKeyword1.primaryKey()));
        return null;
    }
    //End satellite completion 1
   
    //satellite completion2
        public NSArray<EORefidx> currentsKeywords2(String value){
            NSArray<EORefidx> result = new NSArray<EORefidx>();
            result = EORefidx.REFIDXVAL.containsAll(value).filtered(allKeywords2);
            return result;
        }
       
        public NSArray<EORefidx> currentsKeywords2(){
            return currentsKeywords2(wordValue1);
        }
       
        public WOActionResults submitted2() {
            System.out.println("AutoComplete2.submitted: " + wordValue2 + ", " + selectKeyword2);
            return null;
        }
        //End satellite completion 2
Envoyé depuis iCloud

Le 24 nov 2011 à 05:16, Paul D Yu <email@hidden> a écrit :

Raymond

Please provide sample of your HTML and bindings.

I haven't use that component personally.  Did you look in the wonder examples to see how this has to be structured?

Paul

Sent from my iPad

On Nov 24, 2011, at 6:16 AM, Raymond NANEON <email@hidden> wrote:

Hi Paul,

I use debug mode to view how ajaxAutoCompletion use variables and I'm surprised about autoCompletion never set selection variable.

Is this normal for an autoCompletion?

I put a breakpoint on this method

public void setMyObjectSelection(MyClass myObject) {
 _myObjectSelection = myObject
);
and runtime never stop there.

thanks.

Sorry for late answer, I was in training for Talend.
Envoyé depuis iCloud

Le 17 nov 2011 à 03:31, Raymond NANEON <email@hidden> a écrit :

Hi Paul,

Thanks a lot.

I go to try your methods.

Ray
Envoyé depuis iCloud

Le 17 nov 2011 à 03:14, Paul Yu <email@hidden> a écrit :

Raymond

I find that using the following variable naming convention helps a lot.

public MyClass myObjectItem;  //  used for binding to item binding
private MyClass _myObjectSelection;  // used for binding to selection binding

public MyClass myObjectSelction() { return _myObjectSelection};

public void setMyObjectSelection(MyClass myObject) { _myObjectSelection = myObject );

private NSArray<MyClass> _myObjects;  // for binding to list of the component

public NSArray<MyClass> myObjects {
if (_myObjects == null) {
_myObjects = MyClass.fetchAllMyObjects(editingContext(), MyClass.SORT_ATTRIBUTE.ascs());
}
return _myObjects;
}

// if there is an AjaxObserveField action

public WOActionResults selectedMyObject() {
// do what you need to do here.
return null;
}

Hope this helps.

Paul

On Nov 17, 2011, at 6:04 AM, Raymond NANEON wrote:

Hi Stefan,

I don't use selectedMotClefs because the value on selected item is NULL so I get javaNullPointerException in lesMotsClefs1() method with selectedMotClefs in parameter, it's the reason why I stuck on this problem.

Thanks for your help
Envoyé depuis iCloud

Le 17 nov 2011 à 02:51, Stefan Klein <email@hidden> a écrit :

Hi Raymond,

that sounds like you are using the value bound to "item". Try using selectedMotClefs and selectedMotClefs1;

Stefan

 WWW  : http://www.buero-sde.de

 EMail: email@hidden

Am 17.11.11 11:08, schrieb Raymond NANEON:
Hi All,

I try to create a cascading autocompletion but I have a big problem retrieving the id of the selected item. In fact when I select the data, the id that I get is the last item in the list. What I mean is that the id of the selected item never changes and I am completely stuck.

Example

HTML :

<wo name = "autoCompAOF1"><webobject name = "motClefsAutoComplete1" /></wo>
<webobject name = "autoComp2AUC">
                <div id = "searchForm">
                  <webobject name = "motClefsAutoComplete2" />
                </div>
  </webobject>

WOD :

motClefsAutoComplete1 : AjaxAutoComplete {
    id = "auto1";
    list = matchMotcClefs;
    item = motClefsRepetition;
    displayString = .motClefsRepetition.refidxval;
    selection = selectedMotClefs;
    value = motClefs;
}

autoCompAOF1 : AjaxObserveField {
    id="autoCompAOF1";
    fullSubmit = true;
    elementName = "span";
    action = "">     updateContainerID = "pop2";
}

motClefsAutoComplete2 : AjaxAutoComplete {
    id = "auto2";
    list = matchMotcClefs1;
    item = motClefsRepetition1;
    displayString = motClefsRepetition1.refidxval;
    selection = selectedMotClefs1;
    value = motClefs1;
}

JAVA :

// AutoCompletion1 data list
    public NSArray<EORefidx> matchMotcClefs() {
        if(matchMotcClefs == null){
            if(motClefs == null){
                matchMotcClefs = null;
            } else {
                matchMotcClefs = EORefidx.REFIDXVAL.containsAll(motClefs).filtered(lesMotsClefs());
            }
        }
        return matchMotcClefs.immutableClone();
    }
   
  
// AutoCompletion2 data list which depends to selected item in AutoCompletion1
    public NSArray<EORefidx> matchMotcClefs1() {
        if(matchMotcClefs1 == null){
            if(motClefs1 == null){
                matchMotcClefs1 = null;
            } else {
                matchMotcClefs1 = EORefidx.REFIDXVAL.containsAll(motClefs1).filtered(listMotclefs1);
            }
        }
        return matchMotcClefs1.immutableClone();
    }

private NSArray<EORefidx> lesMotsClefs(){
        if(listMotclefs == null){
            listMotclefs = EORefidx.fetchGetMotsClefsParents(session().defaultEditingContext());
        }
        return listMotclefs;
    }
   
    public NSArray<EORefidx> lesMotsClefs1(){
        if(listMotclefs1 == null){
            listMotclefs1 = EORefidx.fetchGetMotClefs(session().defaultEditingContext(),Integer.valueOf(motClefsRepetition.primaryKey()));
        }
        return listMotclefs1;
    }

    public WOActionResults refreshPop2() {
        if (motClefsRepetition() != null) {
           
lesMotsClefs1();
        }

        return null;
    }


Thank you for your help
Envoyé depuis iCloud


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [RESOLVED] Cascade autoCompletion
      • From: Paul Yu <email@hidden>
  • Prev by Date: Re: Connection Dictionary for ERAttachment (go away!)
  • Next by Date: Re: [RESOLVED] Cascade autoCompletion
  • Previous by thread: Re: How to handle "system" preferences?
  • Next by thread: Re: [RESOLVED] Cascade autoCompletion
  • Index(es):
    • Date
    • Thread