Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


jQuery show results in the Flexigrid  on the user selection

Posted on 2008-06-13
Medium Priority
Last Modified: 2010-04-21
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
Question by:newbie27
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Author Comment

ID: 21782765
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

LVL 82

Accepted Solution

hielo earned 2000 total points
ID: 21785532
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.

Author Comment

ID: 21788309
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


Author Closing Comment

ID: 31467081

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question