FoxInCloud
Auto completion
Gravatar is a globally recognized avatar based on your email address. Auto completion
  Vincent H.
  All
  Aug 11, 2019 @ 09:53am

Hi Thierry,

I'm tearing my hair out with this wonderful new self completion control 😃)
When rowSource is a cursor, in a screen in private data session, how to make the list refreshed each time the screen is launched ?
In fact, if my cursor data changes, I can not update the search.
Should I run a jQuery command in the Refresh ()?
thank you in advance

Gravatar is a globally recognized avatar based on your email address. re: Auto completion
  Vincent H.
  Vincent H.
  Aug 12, 2019 @ 12:12am

As sometimes happens, the answer is in the question ...
In the refresh (), you just have to enter the wcHTMLGen () code as follows:

* Code repris de wcHTMLGen()
IF THISFORM.wBSlHTMLgen 
   if Reccount(this.RowSource_) < this.wACnLocalMax
      wACcCandExpr = this.wACcCandExpr
      wAClCandDesc = Iif(this.wAClCandDesc, 'DESC', '')
      select &wACcCandExpr;
        from (this.RowSource_);
        order by 1 &wAClCandDesc;
        into array aa
      cScript = cLitteralJS(@m.aa, .T., .T.)    
   else
      cScript = Textmerge([function(query, process){return jQuery.get('AJAXautoComp.<<m.toHTMLgen.oConfigApp.cApp>>?value=' + query + '&ObjAddr=<<URLEncode(this.wcID)>>', process)}])
   endif
   text to cScript textmerge noshow flags 1 pretext 15
      jQuery('#<<this.wcID>>').typeahead({
           minLength: <<this.wACnLengthMin>>
         , highlight: true
         , items: 'all'
        , source: <<m.cScript>>
         , sorter: function(items){!items.length && this.$menu.html(""); return items;}
         , afterSelect: function(item){jQuery('#<<this.wcID>>').select()}
         });
   endtext
   THISFORM.wcScriptJSadd(m.cScript)
ENDIF
Gravatar is a globally recognized avatar based on your email address. re: Auto completion
  FoxInCloud Support - Thierry N.
  Vincent H.
  Aug 12, 2019 @ 03:03am

Hi Vincent,

The only case where I see this potential issue is Reccount(this.RowSource_) < this.wACnLocalMax, working with a local data source (created using JavaScript instead of querying the server).

Is it where you are?

Gravatar is a globally recognized avatar based on your email address. re: Auto completion
  Vincent H.
  FoxInCloud Support - Thierry N.
  Aug 12, 2019 @ 03:54am

Yes it is (for the moment, because th table will grow)

Gravatar is a globally recognized avatar based on your email address. re: Auto completion
  FoxInCloud Support - Thierry N.
  Vincent H.
  Aug 12, 2019 @ 04:41am

Then you can just set this.wACnLocalMax = 0 to force querying the server, hence the cursor.

Gravatar is a globally recognized avatar based on your email address. re: Auto completion
  Vincent H.
  FoxInCloud Support - Thierry N.
  Aug 12, 2019 @ 04:56am

Much simpler and more effective, thank you !

© 1996-2019