higrid.net


hgAutocomplete\hgAutocomplete
hgAutocomplete.php at line 15

Class hgAutocomplete

hgAutocomplete

public abstract class hgAutocomplete

Author:
She Yi [email protected]
Copyright:
HiGrid.net
Version:
2.1

Field Summary
string

$ajaxtype

Determines the ajax type made to the server.

bollean

$cache

When set to true enables client side caching of the results.

mixed

$encoding

Set the encoding

string

$fontsize

the font size of the autocmplete default is 11px.

string

$height

Determines the height of the autocomplete elemnt.

string

$higridSC

Defines the select command for obtaining the data from the database.

boolen

$loadAll

Determines if the data should be loaded at once from the SQL siurce.

string

$scroll

Determines if the content in autocomplete should have a scroll.

string

$searchType

Set the search type for the LIKE SQL operator.

mixed

$strictcheck

string

$version

Info about the version

Constructor Summary
void

__construct(resource db)

Constructor

Method Summary
boolean

isNotACQuery()

Check if the autocompleter is already created so that we can do various things like data export.

mixed

getOption(string -, mixed option)

Return the the requested option of the autocomplete

boolean

setOption(string option, mixed value)

Set the desired option for autocomplete.

void

setEvent(string event, string code)

Set a JavaScript event for the autocomplete.

none

setSource(mixed source)

Set the source need for autocomlete to send a data.

void

setLength(mixed num)

Set the limit of the requested data in case of SQL command

object

queryAutocomplete()

Return the result for the autocomplete as PHP object.

string

renderAutocomplete(string element, target, boolean script, boolean echo, boolean runme)

Main method which do everthing for the autocomplete.

Field Detail

hgAutocomplete.php at line 131

ajaxtype

public string $ajaxtype = "GET"

Determines the ajax type made to the server. Defaut is GET. Can be a POST


hgAutocomplete.php at line 89

cache

public bollean $cache = false

When set to true enables client side caching of the results. This prevent multiple queries to the database. Please use with care.


hgAutocomplete.php at line 151

encoding

public mixed $encoding = "utf-8"

Set the encoding


hgAutocomplete.php at line 157

fontsize

public string $fontsize = '11px'

the font size of the autocmplete default is 11px. Can be in any measure.


hgAutocomplete.php at line 147

height

public string $height = "110px"

Determines the height of the autocomplete elemnt. Work only if $scroll option is set to true.


hgAutocomplete.php at line 104

higridSC

public string $higridSC = ''

Defines the select command for obtaining the data from the database. Usually this type of command contain the SQL LIKE operator. If the command contain where clause we suppose that this command contain LIKE operator. The serched fields should comtain ? plece holder in order to search om the term element send from the autocompleter. Example: SELECT field1, field2 FROM table WHERE field1 LIKE ? OR field2 LIKE ? As seen you should place a placeholder on the serched fields. The class add the term element automatically to the query. For additional information see the documantation

See Also:
$searchType

hgAutocomplete.php at line 125

loadAll

public boolen $loadAll = false

Determines if the data should be loaded at once from the SQL siurce. Also when set to true only one requrest is done and the data then is stored at client side. No more requests to the server.


hgAutocomplete.php at line 140

scroll

public string $scroll = false

Determines if the content in autocomplete should have a scroll. Use this option with the height option - see below. If this option is not set the content will have height equal of the responce rows.

See Also:
$height

hgAutocomplete.php at line 117

searchType

public string $searchType = "startWith"

Set the search type for the LIKE SQL operator. The possible values are startWith - set LIKE value%; contain - set LIKE %value%; endWith - set LIKE %value;

If the value does not match any of the above setting the SQL command is interpreted as it is without adding any additional strings.


hgAutocomplete.php at line 158

strictcheck

public mixed $strictcheck = true

hgAutocomplete.php at line 21

version

public string $version = '2.1'

Info about the version


Constructor Detail

hgAutocomplete.php at line 175

__construct

public void __construct(resource db)

Constructor

Parameters:
db - the database connection passed to the constructor. In case of array set to 'local'

Method Detail

hgAutocomplete.php at line 164

isNotACQuery

public boolean isNotACQuery()

Check if the autocompleter is already created so that we can do various things like data export.


hgAutocomplete.php at line 200

getOption

public mixed getOption(string -, mixed option)

Return the the requested option of the autocomplete

Parameters:
- - the requested option or event.

hgAutocomplete.php at line 216

setOption

public boolean setOption(string option, mixed value)

Set the desired option for autocomplete. For a full list of the option refer the documentation


hgAutocomplete.php at line 238

setEvent

public void setEvent(string event, string code)

Set a JavaScript event for the autocomplete. For all the possible events refer the documentation


hgAutocomplete.php at line 250

setSource

public none setSource(mixed source)

Set the source need for autocomlete to send a data. Can be a string or array. If the option is string then this is the url from where to obtain the data.


hgAutocomplete.php at line 329

setLength

public void setLength(mixed num)

Set the limit of the requested data in case of SQL command

Parameters:
num - - if set as number determines the number of the requestd itemd from the query. If set to false loads all the data from the query.

hgAutocomplete.php at line 343

queryAutocomplete

public object queryAutocomplete()

Return the result for the autocomplete as PHP object. Determines automatically the placeholders (?) used into the SQL command


hgAutocomplete.php at line 430

renderAutocomplete

public string renderAutocomplete(string element, target, boolean script, boolean echo, boolean runme)

Main method which do everthing for the autocomplete. Should be called after all settings are done. Note that in one file we can have more than one autocomplete definitions. Construct the autocomplete and perform Query operations.

Parameters:
element - The DOM element on which audocomplete should be applied
target - - if set the value selection from autocomplete will be set to this element
script - - if set to false the script tag: