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_TopicIcon
scroll into view
26/03/2009
09:20
Avatar
sledge
Member
Members
Forum Posts: 28
Member Since:
07/04/2008
sp_UserOfflineSmall Offline

Hello, I won't repeat myself, that this plugin is the best;

Is it possible to automatically scroll the newly added row into focus (visibility)?

I have modified grid.base.js:addRowData with row.scrollTop = 0; but it did not do the job..

Thanks huge!
--
sledge

30/03/2009
03:44
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Use the newly  option scrollrows : true and then apply a setSelection to the new added row - jqGrid is flexible 🙂

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.

24/07/2009
07:52
Avatar
glemarie
France
Member
Members
Forum Posts: 66
Member Since:
19/12/2008
sp_UserOfflineSmall Offline

Hi,

I use scrollrows:true and setSelected, but the grid does not scroll dynamically (the row is correctly selected). My code is :

jQuery(document).ready(function(){
var initialLoad = true;
jQuery("#listSociete").jqGrid({
scrollrows : true,
url:'getValues.php?type=contentSociete',
datatype: "json",
colNames:['Nom','Secteur d\\'Activité', 'Progiciel', 'Commercial'],
colModel:[
{name:'Nom',index:'Nom', align:"left", sortable:true, search: true},
{name:'NomSecteur',index:'NomSecteur', sortable:true, search: true},
{name:'NomOutil',index:'NomOutil', sortable:true, search: true}
,{name:'NomCommercial',index:'NomCommercial', sortable:true, search: true}
],
hidegrid: false,
hiddengrid: false,
loadui:'block',
loadtext:"Chargement...",
pager: jQuery('#pagerSociete'),
pgbuttons:false,
pginput:false,
viewrecords:true,
sortname: 'Nom',
sortorder: "asc",
caption: "Sociétes",
forceFit: true,
loadonce: false,
width: 1000,
onSelectRow: function(rowid) {
// Memorisation de la societe selectionnee
memoriseVariable('societeSelected', rowid); // Puts id in a COOKIE
},
loadComplete: function() {
// Selection de la ste memorisee
if (initialLoad && recupereVariable('societeSelected')) // If first lload and cookie is set
jQuery("#listSociete").setSelection(recupereVariable('societeSelected'), true);
initialLoad = false;
}
});
27/07/2009
02:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

It is not setSelected, but setSelection - check the right syntax in the docs.

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.

10/08/2009
10:27
Avatar
glemarie
France
Member
Members
Forum Posts: 66
Member Since:
19/12/2008
sp_UserOfflineSmall Offline

Hi Tony,

My code was not properly included in my post, but my syntax is correct : I use the setSelection mothod...

11/08/2009
10:55
Avatar
Joe
Guest
Guests

Hi,

I have the same problem too.

I ture on the scrollrows and use setSelection.

the row was  been selected correctly,

but the scroll bar still can't fouce on the new row.

Plx help!

13/08/2009
01:17
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello glemarie,

You use this in loadComplete - this will not work - since not all the data is alredy into the grid. Try to use this after the grid is loaded

and you will see that this will work. Not sure what you try to do, but maybe gridComplete is your event.

A simple test:

$("#mybutton").click(function(){

// here your code with set selection

})

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.

16/09/2009
17:55
Avatar
ignrac
Member
Members
Forum Posts: 6
Member Since:
17/09/2009
sp_UserOfflineSmall Offline

Hi tony,

jqGrid 3.5.3,  'scrollrows' parameter not scroll to row selected. The row is selected but not scroll in view.

I tried in 'gridcomplete' event and a button click event.

The grid options are simple:

jQuery("#list").jqGrid({

    url: jq_url,
    datatype: "xml",
    colNames:[etc, etc],
    colModel:[{etc},{etc}],
     rowNum:25,
     rowList:[25,50,75],
     gridview: true,
     scrollrows: true,
     height: jq_Height,
     hidegrid: false,
     loadui:"block",
     caption: jq_caption,
     loadBeforeSend: function(xhr){
         jq_rowsBackground = rowsBackground();
     },
     gridComplete: function() {
       
        if (jq_rowsBackground !== undefined) {
            if (jq_rowsBackground.records > 0) {
                $.each(jq_rowsBackground.rows, function(row){
                    jQuery('tr#'+ this,'#list').css({background:'#d3f7cf'});
                });
            }
        }
       if (jq_last_visit != 0){
           jQuery("#list").setSelection(jq_last_visit);
       }
    }

});

Code Comments: (All 'jq*' are Javascript variables. No Pager if datasource is ODBC, Pager active if datasource is MySql.)

Best regards,

Ignacio

18/09/2009
03:31
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Not sure if this is a case, but there was a bug (which is corrected in GitHub) when the parameter is number - i.e. in your case jq_last_visit is number. Try this:

jQuery(”#list”).setSelection(jq_last_visit+"");

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.

18/09/2009
11:57
Avatar
ignrac
Member
Members
Forum Posts: 6
Member Since:
17/09/2009
sp_UserOfflineSmall Offline

Indeed, the jq_last_visit variable contains numeric data ('2755 ').
However, I changed the code to make it a string data type ( 'r2755'), the behavior is the same, the row is selected and not scroll in view.
I tested from GitHub grid.base same thing.
After many tests, I found the solution: the problem occurs when there is no previously selected row.
I changed the code to:

     gridComplete: function() {
        jQuery(”#list”).setSelection(jq_first_row_id("#list"));
        if (jq_rowsBackground !== undefined) {
            if (jq_rowsBackground.records > 0) {
                $.each(jq_rowsBackground.rows, function(row){
                    jQuery('tr#'+ this,'#list').css({background:'#d3f7cf'});
                });
            }
        }
       if (jq_last_visit != 0){
           jQuery(”#list”).setSelection(jq_last_visit);
       }
    }

function jq_first_row_id(gridID){
    var grid = jQuery(gridID);
    rowsID = grid.getDataIDs();
    return rowsID[0];
}

In the button click event:

       jQuery(”#list”).setSelection(jq_first_row_id("#list"));
       if (jq_last_visit != 0){
           jQuery(”#list”).setSelection(jq_last_visit);
       }

Now is scroll in view. (Clearly, there is always checked rows in grid.). Only a 'mini' problem: only middle row in view, because the row height is not multiple of the height of the grid table.

Many thanks for your assistance.

Best regards,

Ignacio

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
73 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