christiansalazar avatar christiansalazar committed ebd785c Merge

Merge /gh/protected/extensions/efilterwidget

Comments (0)

Files changed (3)

EFilterWidget.php

 	public $pleaseSelectText;	// "-please select-"
 	public $fields;				// array. see doc.
 	public $action;				// action array URL
+
+	public $actionInputArgumentID; // input tag ID, containing data 
+								 // to be attached to the action URL
+								 // so the action will read it and acts
+								 // in response to this argument.
 	
 	// WAW1: using an ID as receptor for selected value uppon user clicks "OK"
 	public $receptorId; 
 			'loading'=>$imgloading,
 			'pleaseSelect'=>$this->pleaseSelectText,
 			'receptorId'=>$this->receptorId,
+			'argumentId'=>$this->actionInputArgumentID,
 			'onSuccess'=>new CJavaScriptExpression($this->onSuccess),
 			'onError'=>new CJavaScriptExpression($this->onError),
 		));
     				'options'=>array(''=>'??','JAN'=>'Enero','FEB'=>'Febrero'),
     			),
     	),
+
+		// 	use this attribute to pass any data readed from your Form.
+		//	suppose you have $form->textField($model,'anyattribute');
+		//  containing a value to be passed back to your action in order
+		//	to perform a search.
+		//
+		//	in your action this value is passed via 'arg' attribute name
+		//	$_GET['arg']  
+		//
+		'actionInputArgumentID'=>'Form_anyattribute',
+
     	'action'=>array('site/efilterwidgetsample'),
     	'receptorId'=>'testValue',
     	'onSuccess'=>"function(data){ $('#logger').html(data); }",
 	// 	each key present in URL argument. is a helper.
 	//	is a comma-separated key names string.	
 	$keys = explode(",",$_GET['keys']);
+
+	// a value readed from your form referenced by: 'actionInputArgumentID'
+	$anyValue = $_GET['arg'];
+
 	// sample array filtered by argument passed by URL
 	//	example:  
 	//	Person::model()->findByAttributes(array('uid'=>$_GET['uid']));
 	echo CJSON::encode(CHtml::listData($sample, 'userid', 'name'));
 }
 ?>
-~~~
+~~~

assets/efilter.js

 		return result;
 	}
 
+	// FIND BUTTON CLICK EVENT
 	$('#'+options.findid).click(function(){
 		var urlArgs='';
 		var kk='';
 		});		
 	    // plus special argument: keys
 		urlArgs += '&keys='+kk;
+		urlArgs += '&arg='+$('#'+options.argumentId).val();
 		
 		var loading = $('#'+options.loading);
 		var find = $('#'+options.findid);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.