Link to home
Start Free TrialLog in
Avatar of newbie27
newbie27Flag for United Kingdom of Great Britain and Northern Ireland

asked on

jQuery Flexigrid show cookie data

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
Avatar of newbie27
newbie27
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER



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

Avatar of hielo
try changing:
if( "null" !=  myList[x].id )  

to
if( null !=  myList[x].id )  
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
>>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?
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
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

ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes, this is what it is happening now.
please  hielo, can you advice me how to resolve this issue.



thanks