Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
True Scrolling not working and need to keep selected
15/06/2010
20:20
Avatar
kmomzig
New Member
Members
Forum Posts: 2
Member Since:
15/06/2010
sp_UserOfflineSmall Offline

Hi,

Trying to use true scrolling on an existing grid and not having any luck. The paging does work when I sort a column but not on initial data load. Also I am needing to retain the values selected everytime data is loaded. This is a multiselect grid and I am using the latest build of jqgrid

* jqGrid  3.7.1 - jQuery Grid
* Date:2010-06-15
* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.postext.js; grid.jqueryui.js;

The grid code is this.

$("#list").jqGrid(
            {
                scroll: 1,
                url:'../Todo/todoHandler.cfm?event=todo.getLocations', //CFC that will return the users
                datatype: 'json', //We specify that the datatype we will be using will be JSON
                colNames:['ID','Name','State','OPUnit'], //Column Names
                colModel :[
                    {name:'id',index:'id',sorttype:"int",width: 20, hidden:true},
                    {name:'Name',index:'Name', width:250,align:"left",sorttype:"text"},
                    {name:'State',index:'State', width:250,align:"left",sorttype:"text"},
                    {name:'OPUnit',index:'OPUnit', width:180,align:"left",sorttype:"text"}
                ],                                               
                pager: '#pscrolling', //The div we have specified, tells jqGrid where to put the pager
                rowNum:200, //Number of records we want to show per page
                sortorder: "asc", //Default sort order
                sortname: "Name", //Default sort column
                postData: {usertype: 'User'},
                viewrecords: true, //Shows the nice message on the pager
                height:400, //I like auto, so there is no blank space between. Using a fixed height can mean either a scrollbar or a blank space before the pager
                mtype:'GET',
                gridview: true,
                rownumbers: true,
                multiselect: true, //gridMultiSelectSwitch,
                //Things to do when grid is finished loading
                loadComplete:function(){
                        var ids = $('#list').getDataIDs();
                        var gridRecCount = 0;     
                        
                        if ($('#list').getGridParam('records') > 0) {
                            gridRecCount = $('#list').getGridParam('records');
                        }        
                        if (gridRecCount == 0) {
                            if ($('#initGridLoad').val() == 1)    {    
                                $('#ResultList').hide();
                                $('#resultNoRecord').show();
                            }
                        }
                        else {
                            $('#ResultList').show();            
                            $('#resultNoRecord').hide();
                            
                        }    
                        setTimeout(function(){
                            <cfoutput>
                            
                            if ( valueArray[0] != undefined ) {
                                for(var i=0; i<valueArray.length; i++){
                                    $('##list').setSelection(valueArray[i],true);
                                };
                            };
                            </cfoutput>

                            parent.iframeInit();
                        }, 500);
                    
                    },
                gridComplete: function() {
                    
                },
                onSelectAll : function(aSel,selected) {
                    var value = '' ;
                    value = jQuery("#list").getGridParam('selarrrow');    
                    //alert(value);
                    $('#locationId').val(value);
                },
                onSelectRow : function(rowid, selected){
                    var value = '' ;
                    value = jQuery("#list").getGridParam('selarrrow');
                    $('#locationId').val(value);
                    jClist = value;                   
                    
                },
                //The JSON reader. This defines what the JSON data returned from the CFC should look like
                jsonReader: {
                    root: "ROWS", //our data
                    page: "PAGE", //current page
                    total: "TOTAL", //total pages
                    records:"RECORDS", //total records
                    userdata:"USERDATA", //Userdata we will pass back for feedback
                    cell: "", //Not Used
                    id: "0" //Will default to frist column
                    }
                }
            );   

Thanks

Kevin

20/06/2010
11:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

There is internal function called selectionPreserver which do this automatically for you when you are in multiselect mode.

So remove you code from loadComplete and you will have what you want.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

30/06/2010
06:39
Avatar
kmomzig
New Member
Members
Forum Posts: 2
Member Since:
15/06/2010
sp_UserOfflineSmall Offline

tony said:

Hello,

There is internal function called selectionPreserver which do this automatically for you when you are in multiselect mode.

So remove you code from loadComplete and you will have what you want.

Regards

Tony


tony,

Thanks for the response. I ended up having to slightly modify what you see there for preserving my choices. The reason for that code is that I am using the grid to select options in a form wizard, so I have to repopulate on browser paging.

If there is a way to use selectionPreserver to pass in a already defined set of values I'll do that (as this funciton is not documented I have not looked at the source).

My other issue is that the aboe code I posted I cannot get 'true scrolling' to work. So not sure if an option I specified is preventing that.

Thanks.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
44 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information