/**
  * Sets the sijax function to call when requesting suggestions.
  *
  * @param string $functionName
  */
 public function setCallback($functionName, $callback)
 {
     $this->_params[self::PARAM_CALLBACK] = $functionName;
     $params = array(Core_Sijax::PARAM_RESPONSE_CLASS => __CLASS__ . '_Response');
     Core_Sijax::registerCallback($functionName, $callback, $params);
     return $this;
 }
 /**
  * Helper function to simplify registering comet functions with Sijax.
  *
  * @param string $functionName
  * @param callback $callback
  * @param array $params
  */
 public static function registerCallback($functionName, $callback, $params = array())
 {
     if (!isset($params[Core_Sijax::PARAM_RESPONSE_CLASS])) {
         $params[Core_Sijax::PARAM_RESPONSE_CLASS] = __CLASS__ . '_Response';
     }
     Core_Sijax::registerCallback($functionName, $callback, $params);
 }
 /**
  * Used internally to overwrite the arguments passed to the response function.
  * @return array
  */
 public function getRequestArgs()
 {
     $postData = Core_Sijax::getData();
     unset($postData[Core_Sijax::PARAM_REQUEST]);
     unset($postData[Core_Sijax::PARAM_ARGS]);
     Core_Sijax::setRequestArgs(array($postData));
     return array($postData);
 }
Example #4
0
?>

			if (typeof($) === 'undefined') {
				alert('Failed to load jquery. Sijax relies on Jquery to work!');
			}

			if (typeof(Sijax) === 'undefined') {
				alert('Failed to load sijax.js! This example will not work unless you fix it!');
			}

			if (typeof(sjxSuggest) === 'undefined') {
				alert('Failed to load sijax_suggest.js! This example will not work unless you fix it!');
			}

			<?php 
echo Core_Sijax::getJs();
?>
			<?php 
echo $registrationScripts;
?>

			//This will be called when a tag is picked
			var selectTag = function(tagName) {
				//We could modify the textbox contents to really auto-complete the word, etc..

				$('#debug').append('Selected tag: `' + tagName + '`');
			};
		</script>

		<style>
		.sjxSuggest-item {
Example #5
0
 /**
  * Sets the request arguments, possibly overriding the autodetected arguments array.
  * This is useful for plugins that would like to "rewrite" the arguments array.
  *
  * @param array $args
  */
 public static function setRequestArgs(array $args)
 {
     self::$_requestArgs = $args;
 }