[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

jQuery Flexigrid show cookie data

Posted on 2008-06-23
11
Medium Priority
?
1,186 Views
Last Modified: 2010-04-21
Hello Experts,
I am using jquery flexigrid to show data from the cookie. It is displaying the data correctly as a default result set. But then when I want to view it manually by selecting the cookie name from the drop down, this function is not showing the Flexigrid at all. Although the Ajax is returning correct data required.
Please can someone of you look into this.
Thanks
Sam
0
Comment
Question by:newbie27
  • 8
  • 3
11 Comments
 
LVL 8

Author Comment

by:newbie27
ID: 21845031


function showCookieList(){
       var sRefNos = "";
		var myList = showShortList();
     	for(var x=0; x<myList.length; x++)
		{    if( "null" !=  myList[x].id )                
         		sRefNos += "," + myList[x].id  ;        
     	}
     	sRefNos = sRefNos.substr(1);
      
     	var sQuery = "SF1=keyword&ST1="+sRefNos; 
		alert(sQuery);
    	$('#flexicontainer').html('<table id="listDisplay" style="display:none"></table>'); 
		listViewer("#listDisplay", sQuery);		
}  
		
 
 
//this actually fills in the flexigrid table.
function listViewer(listID, param1)
{      
		$(listID).flexigrid
		({
        		url: 'list_proxy.asp?a=results',       
        		colModel : [                                     				
					    //{display: '<input type="checkbox" name="chkAll" onclick="checkAll(&#39;#listDisplay&#39;)"/> All', width : 30},
						//{display: '', width : 30},						
						{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 : 50, sortable : true, align: 'left'},
                    	{display: 'Group  ', name : 'co_group', width : 150, sortable : true, align: 'left'},                 
						{display: 'Notes', name : 'notes', width : 200, sortable : false, align: 'left'}
        			],
        		buttons : [                             
                         {name: 'Save', bclass: 'add', onpress : test},	
						 {name: 'Remove', bclass: 'delete', onpress : test},					                
						 {name: 'Export', bclass: 'add', onpress : test},							 
						 {name: 'Merge', bclass: 'add', onpress : test},	
						 {name: 'DeSelect All', bclass: 'delete', onpress : test},	
						 {name: 'Select All', bclass: 'add', onpress : test},	
						 
                  	],                                      
        		sortname: '',
        		sortorder: 'asc',
        		usepager: false,
        		title: 'List Name - ' + $("#drpLists").val(),
        		useRp: true,
        		rp: 1000,
        		query : param1+'&Fields=ref_no,pe_rev_name,co_name,action_flag,co_group,notes',         
        		showTableToggleBtn: true,                       
        		width: 760,
        		height: 350,
				onSuccess:function()
	   			{
                		$(".edit_area").editable( 
						function(value, settings) { return(value); }, 
                			{     
							submit    : "OK",
							indicator : "process..........",
							tooltip   : "Click to edit...",
							style     : "inherit" ,
							type      : "textarea",
   						    indicator : "<img src='images/indicator.gif'>"
 
 
                			}
					);
				}
        		
        	});
 
}

Open in new window

0
 
LVL 82

Expert Comment

by:hielo
ID: 21894397
try changing:
if( "null" !=  myList[x].id )  

to
if( null !=  myList[x].id )  
0
 
LVL 8

Author Comment

by:newbie27
ID: 21895346
hello hielo,
please add few items to the shortlist and try picking from the drop down...it is is not not showing the shortlist details in the grid
0
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.

 
LVL 8

Author Comment

by:newbie27
ID: 21895456
0
 
LVL 82

Expert Comment

by:hielo
ID: 21895889
>>please add few items to the shortlist and try picking from the drop down...it is is not not showing the shortlist details in the grid
I added items, clicked save. On the other page I picked a different item from the select list, clicked on view list and the old grid data disappeared and a new data showed on flexigrid. I tried FF and IE6. I can't recreate the problem. Perhaps you are not accepting cookies?
0
 
LVL 8

Author Comment

by:newbie27
ID: 21903023
hello hielo,
thanks for looking into this for me, i am accepting cookies hielo, but the problem is not first time you view the list.

>> I added items, clicked save. On the other page I picked a different item from the select list, clicked on view list and the old grid data disappeared and a new data showed on flexigrid

this is ok hielo, the problem, is 1) when you add new item to the list, after saving the list by some name the grid is not holding the newly added list, rather it is defaulting to shortlist data.

2)  when you pick any list from the drop down, it is showing the data correctly in the grid but when I now chose the shortlist from the drop down, the cookie list is not been displayed..

i hope you see the problem here?

thanks alot for your help

regards
sam
0
 
LVL 8

Author Comment

by:newbie27
ID: 21907084
for my second problem, it is not showing the grid from the showCookieList function Hielo.

showCokieList function calling listViewer function and passing ID and Param1 correctly but the flexigrid is still seems to be hidden...

please can you help me

thanks
sam

function getListRefs(sListname)
{       
       
		if(sListname == "shortlist"){
			//alert('getListRefs='+sListname);
			if( $.cookie('shortlist') )    
         
                showCookieList();
				
				$("#txtListName").val('ShortList');
				$("#txtNotes").val('');
        }else{ 
			$.ajax({
			  type: "POST",
			  url: "list_builder.asp",
			  data: "action=results&listname="+sListname,
			  success: function(xml)
							{								
								/*var errCode = $("errorcode",xml).text();
								var errMsg  = $("errormsg",xml).text();
								var rsTexts  = $("responsetext",xml).text();*/
								var temp    = xml.split("|");
								var sName = temp[0];      // List Name
								var sNotes =temp[1];      // List Notes
								var sIds = temp[2];	   // List RefNos 
								 
								//alert(xml);
								if(sIds){
								  // alert('sIds=' + sIds);
										var sRefNumbers = $("#listRefnos").val();
										//alert(sRefNumbers);
										var sViewQuery = "SF1=keyword&ST1="+sRefNumbers; 
										//alert(sViewQuery);
										listViewer("#listDisplay",sViewQuery);										
										$("#txtListName").val(sName);
										$("#txtNotes").val(sNotes);									
								}
							}
			});
		}	
} 
 
 
 
function showCookieList(){
       var sRefNos = "";
		var myList = showShortList();
     	for(var x=0; x<myList.length; x++)
		{    //if( "null" !=  myList[x].id )                
			if( null !=  myList[x].id )  
         		sRefNos += "," + myList[x].id  ;        
     	}
     	sRefNos = sRefNos.substr(1);
      
     	var sQuery = "SF1=keyword&ST1="+sRefNos; 
		alert(sQuery);
    	$('#flexicontainer').html('<table id="listDisplay" style="display:none"></table>'); 
		listViewer("#listDisplay", sQuery);		
}  
 
 
function listViewer(listID, param1)
{       alert(listID + ' ' + param1);
		$(listID).flexigrid
		({
        		url: 'list_proxy.asp?a=results',       
        		colModel : [                                     				
						{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 : 50, sortable : true, align: 'left'},
                    	{display: 'Group  ', name : 'co_group', width : 150, sortable : true, align: 'left'},                 
						{display: 'Notes', name : 'notes', width : 200, sortable : false, align: 'left',process:showNotes}
        			],
        		buttons : [                             
                         {name: 'Save ', bclass: 'save', onpress : test},	
						 {name: 'Remove ', bclass: 'remove', onpress : test},					                
						 {name: 'Export ', bclass: 'export', onpress : test},							 
						 {name: 'Merge ', bclass: 'merge', onpress : test},	
						 {name: 'DeSelect All', bclass: 'deselect', onpress : test},	
						 {name: 'Select All', bclass: 'select', onpress : test},	
						 
                  	],                                      
        		sortname: '',
        		sortorder: 'asc',
        		usepager: false,
        		title: 'List Name - ' + $("#drpLists").val(),
        		useRp: true,
        		rp: 1000,
        		query : param1+'&Fields=ref_no,pe_rev_name,co_name,action_flag,co_group,notes',         
        		showTableToggleBtn: true,                       
        		width: 760,
        		height: 350,
				onSuccess:function()
	   			{
                		$(".edit_area").editable( 
						function(value, settings) { return(value); }, 
                			{     
							submit    : "OK",
							indicator : "process..........",
							tooltip   : "Click to edit...",
							style     : "inherit" ,
							type      : "textarea",
   						    indicator : "<img src='images/indicator.gif'>"
 
 
                			}
					);
				}
        		
        	});
 
}
 

Open in new window

0
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 21911228
In list_admin.asp you have:
$(document).ready(function()
{
  repopulateList("shortlist");  
});

and if you look at repopulateList() you have:

sDrpListName = $("#drpLists").val();
$.ajax(...);

There's not way that will work. When the page first loads, there is no #drpLists.
That list is dynamically retrieved by the $.ajax() request that follows. Hence,
sDrpListName = $("#drpLists").val(); will return undefined.
0
 
LVL 8

Author Comment

by:newbie27
ID: 21912195
yes, this is what it is happening now.
please  hielo, can you advice me how to resolve this issue.



0
 
LVL 8

Author Closing Comment

by:newbie27
ID: 31469683
thanks
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

873 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