Solved

flexigrid query params

Posted on 2008-06-13
2
4,622 Views
Last Modified: 2012-06-27
Hello Experts,
I have a script attached which needs another parameter to pass the query param which is different  for each call
Thanks for your help

I am referring to query param I am using one to get the cookie list and another to get listnames list
 query : sViewQuery+'&Fields=ref_no,notes,pe_rev_name,co_name,action_flag,co_group',        
AND

 query : sQuery+'&Fields=ref_no,notes,pe_rev_name,co_name,action_flag,co_group',        

Rgds
Thx                    



<script type="text/javascript">
 
$(document).ready(function()
        {
                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; 
                repopulateList();
                listViewer("#listDisplay");
        
});     
                
function listViewer(listID)
{
        $(listID).flexigrid
                ({
                        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 : sQuery+'&Fields=ref_no,notes,pe_rev_name,co_name,action_flag,co_group',         
                        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",
                                                        callback  : function (value, settings){if ($(this).hasClass('trSelected')){alert('selected');}  }
                                        }
                                        );
                                }
                });
 
}
 
function test(com,grid)
            {
                if (com=='Delete')
                                        {
                                                if($('.trSelected',grid).length <= 0){ alert('You have not selected any item.');
                                                }else{
                                           if(confirm('Do you want to delete the selected ' + $('.trSelected',grid).length + ' item(s)?')){
                                                var items = $('.trSelected',grid);
                                                var itemlist ='';
                                                for(i=0;i<items.length;i++){
                                                        //itemlist+= items[i].id.substr(3)+","; 
                        // $(".chkRefNos").checked();                           
                                                        removeShortList("shortlist", items[i].id.substr(3));
                                                }                                               
                                                  window.location.reload(true);
                                                  $("#listDisplay").flexReload();
                                                
                                                }}
                                        }
                else if (com=='Select All'){
                                                $('.bDiv tbody tr',grid).addClass('trSelected');
                                  }else if (com=='DeSelect All'){
                                                $('.bDiv tbody tr',grid).removeClass('trSelected');
                                  }          
            } 
                                
 
 
function removeFromList(){
    var result = "";                        
    $(".chkRefNos").each( function () {
      //if(this.checked == true) {             
        removeCookieItem(this);   
     //} 
    }); 
         window.location.reload(true);    
} 
        
                                
function viewList(){
    
  var sListname = $("#drpLists").val();
  
  if(sListname == 0 || sListname == "new"){  
    alert('Please select a list');
  }else{
   
        getListRefs(sListname); 
        //alert("listRefnos=" + $("#listRefnos").val());
        var sRefNumbers = $("#listRefnos").val();
        
         $('#defaultResults').hide();
    var sViewQuery = "SF1=keyword&ST1="+sRefNumbers; 
     // alert(sListname + " : " + sViewQuery);
 
 // sViewQuery  --> this holds the complete query I need to pass
        listViewer("#listDisplay1");
 
    
    
  //  $("#listRefnos").val('');  
  }
 }
</script>

Open in new window

0
Comment
Question by:newbie27
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 21784214

<script type="text/javascript">
 
$(document).ready(function()
        {
                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; 
                repopulateList();
                listViewer("#listDisplay",sQuery);
        
});     
                
function listViewer(listID,sQuery)
{
        $(listID).flexigrid
                ({
                        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 : sQuery+'&Fields=ref_no,notes,pe_rev_name,co_name,action_flag,co_group',         
                        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",
                                                        callback  : function (value, settings){if ($(this).hasClass('trSelected')){alert('selected');}  }
                                        }
                                        );
                                }
                });
 
}
 
function test(com,grid)
            {
                if (com=='Delete')
                                        {
                                                if($('.trSelected',grid).length <= 0){ alert('You have not selected any item.');
                                                }else{
                                           if(confirm('Do you want to delete the selected ' + $('.trSelected',grid).length + ' item(s)?')){
                                                var items = $('.trSelected',grid);
                                                var itemlist ='';
                                                for(i=0;i<items.length;i++){
                                                        //itemlist+= items[i].id.substr(3)+","; 
                        // $(".chkRefNos").checked();                           
                                                        removeShortList("shortlist", items[i].id.substr(3));
                                                }                                               
                                                  window.location.reload(true);
                                                  $("#listDisplay").flexReload();
                                                
                                                }}
                                        }
                else if (com=='Select All'){
                                                $('.bDiv tbody tr',grid).addClass('trSelected');
                                  }else if (com=='DeSelect All'){
                                                $('.bDiv tbody tr',grid).removeClass('trSelected');
                                  }          
            } 
                                
 
 
function removeFromList(){
    var result = "";                        
    $(".chkRefNos").each( function () {
      //if(this.checked == true) {             
        removeCookieItem(this);   
     //} 
    }); 
         window.location.reload(true);    
} 
        
                                
function viewList(){
    
  var sListname = $("#drpLists").val();
  
  if(sListname == 0 || sListname == "new"){  
    alert('Please select a list');
  }else{
   
        getListRefs(sListname); 
        //alert("listRefnos=" + $("#listRefnos").val());
        var sRefNumbers = $("#listRefnos").val();
        
         $('#defaultResults').hide();
    var sViewQuery = "SF1=keyword&ST1="+sRefNumbers; 
     // alert(sListname + " : " + sViewQuery);
 
 // sViewQuery  --> this holds the complete query I need to pass
        listViewer("#listDisplay1",sViewQuery);
 
    
    
  //  $("#listRefnos").val('');  
  }
 }
</script>

Open in new window

0
 
LVL 8

Author Closing Comment

by:newbie27
ID: 31467046
thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

830 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