Simple Example Flexi Grid with Parameters

Now we will discuss next phase of flexi gird, how to pass parameters and reload flexi grid.In this tutorial i will described how to add search/sorting functionality.The flexi grid already have sorting but if you want custom sort ,Eg.: If we want only those record display in flexi grid which has status completed.

To achieve above objective we need to pass status as a parameters and bind again flexi grid with new result set.
I have assume you are aware of flexi grid basic functionality. You.You can read my Previous Post

Also Checkout other tutorials of flexi grid,

Simple code to add Parameters in Flexi Grid

Javascript code:

jQuery("#task_status").live('change', function()
	{

		var status = $('#task_status option:selected').text();
		if(status =='Select All') {
		status =''
		}
		 jQuery("#tasks-listing-grid").flexOptions({query: 'status='+status}).flexReload();
		 
	});

WHERE

  • tasks-listing-grid: This is the target div.
  • Parameters: {query: ‘status=’+status}

PHP code:

if(isset($post['query']) && !empty($post['query'])){
			parse_str($post['query'], $query);
		}