Solved

jQuery Flexigrid show cookie data

Posted on 2008-06-23
11
1,146 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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 500 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
 
LVL 8

Author Comment

by:newbie27
ID: 21912207
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now