Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

jQuery show results in the Flexigrid on the user selection

Hello Folks,
I am making Flexigrid to receive data dynamically by amending param:query based on the user selection.
User has a choice to pick item name from the dynamically populated list which includes the default cookie name and list names from the xml file.
All I wanted to do here is whichever name been selected, make a query, do an ajax request and assign the response to the Flexigrid. Please have my code snippet attached .
Thanks for your help
  • 3
1 Solution
newbie27Author Commented:
Hopefully you may understand what I am trying to say you here If you please see the code attached,

List html data being generated
<SELECT name="drpLists" id="drpLists" style="width:136px; line-height:18px; padding:0; margin:4px;">
<OPTION value="0">Select List</OPTION>
<OPTION value="shortlist" selected> Temp List</OPTION>
<OPTION value="test" >test</OPTION>
<OPTION value="new">New List...</OPTION>

In here the default selection is Temp List which is a cookie by name "shortlist"

so when I call this function
function listViewer(listID, param1)

I either want to display data for "shortlist" or "test"

I want to modify my code to do as desired above, ie
whichever selected show the data in the Flexigrid

perhaps i need to pass another parameter for the listname?

function listViewer(listID, param1,param2?)

Can I not use one listID for these calls anyway? if so then i would not need a parameter for listID.
Other third parameter for the listname...
listViewer("#listDisplay" , sQuery,'shortlist');

Please can you advice me here....

I am sure I have not explained it will but I hope you may understand it !

many thanks for your help and time.

This is the default call
		var sRefNos = "";
		var myList = showShortList();
     	for(var x=0; x<myList.length; x++)
         		sRefNos += "," + myList[x].id  ;        
     	sRefNos = sRefNos.substr(1);
     	var sQuery = "SF1=keyword&ST1="+sRefNos; 
		listViewer("#listDisplay" , sQuery);
to this function
function listViewer(listID, param1)
        		url: 'list_proxy.asp?a=results',       
        		colModel : [                    
                        	{display: ' ', name : 'chkDelete', width : 30, sortable : false, align: 'left'},
					//{display: '<input type="checkbox" name="chkAll" onclick="checkAll(this.checked)"/> All', width : 30},
                        	{display: 'Notes', name : 'notes', width : 50, sortable : false, align: 'left'},
           			{display: 'Contact    ', name : 'pe_rev_name', width : 150, sortable : true, align: 'left'},
                    	{display: 'Compnay Name  ', name : 'co_name', width : 200, sortable : true, align: 'left'},   
                    	{display: 'Flag  ', name : 'action_flag', width : 150, sortable : true, align: 'left'},
                    	{display: 'Group  ', name : 'co_group', width : 200, sortable : true, align: 'left'}                 
        		buttons : [                             
                         {name: 'Delete', bclass: 'delete', onpress : test},
					//	{name: 'Select All', bclass: 'add', onpress : test},
					//{name: 'DeSelect All', bclass: 'delete', onpress : test}
        		sortname: '',
        		sortorder: 'asc',
        		usepager: false,
        		title: 'List Manager - Titles',
        		useRp: true,
        		rp: 1000,
        		query : param1 +'&Fields=ref_no,notes,pe_rev_name,co_name,action_flag,co_group',         
        		showTableToggleBtn: true,                       
        		width: 760,
        		height: 350,
						function(value, settings) { return(value); }, 
							submit    : "OK",
							indicator : "process..........",
							tooltip   : "Click to edit...",
							style  : "inherit",
							callback  : function (value, settings){if ($(this).hasClass('trSelected')){alert('selected');}	}
once the user select the list name, he would click on the show list button to view the detailed for the selected item ...
i am calling this function from button onclick
function viewList(){
  var sListname = $("#drpLists").val();
  if(sListname == 0 || sListname == "new"){  
    alert('Please select a list');
	var sRefNumbers = $("#listRefnos").val();
    var sViewQuery = "SF1=keyword&ST1="+sRefNumbers; 

Open in new window

Since your <SELECT> is the result of an ajax call, you need an onSuccess event handler for that call that will find the selected option and then make the ajax request for the flexigrid control.
newbie27Author Commented:
Hello Hielo,
I have treid but it did not work... can you please help me on this

  function repopulateList()
	  type: "POST",
	  url: "list_builder.asp",
	  data: "action=save&listname="+$("#txtListName").val(),
	  success: function(msg){
							$("#theList").html( msg );								

Open in new window

newbie27Author Commented:

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now