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
getRowData only geting visible rows, does not work with paging
16/01/2011
16:28
Avatar
giorgio79
Member
Members
Forum Posts: 24
Member Since:
14/01/2011
sp_UserOfflineSmall Offline

Ouch, just found out getRowData only returning visible rows. (Using javascript array as source)

(Just like setCell can only set visible rows, that I recently found:

http://www.trirand.com/blog/?p.....-it-fails/)

Is this a bug introduced recently? Perhaps I will try an earlier version? If this is not a bug, how can I get all rows??? If I cannot, I guess jqGrid is useless for me.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8″ />
<title>My First Grid</title>
 
<link rel="stylesheet" type="text/css" media="screen" href="../../js/themes/custom-theme/jquery-ui-1.7.3.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
 
<style>
html,
body {
    margin: 0;
    padding: 0;
    font-size: 75%;
}
</style>
 
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
 
<script type="text/javascript">
var lastgridsel;
$(function(){

var grid_data =
    [
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"3",whoaaa:"huhuhu",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"bhjbjhbj",selected:"0",completed:"1"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"3",whoaaa:"huhuhu",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"bhjbjhbj",selected:"0",completed:"1"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"3",whoaaa:"huhuhu",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"bhjbjhbj",selected:"0",completed:"1"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"3",whoaaa:"huhuhu",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"bhjbjhbj",selected:"0",completed:"1"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"3",whoaaa:"huhuhu",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"bhjbjhbj",selected:"0",completed:"1"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},
    {id:"3",whoaaa:"huhuhu",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"bhjbjhbj",selected:"0",completed:"1"},
    {id:"1",whoaaa:"hehehe",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"1",completed:"1"},
    {id:"2",whoaaa:"hahaha",ko:"9",first_name:"John",last_name:"Kan",username:"huhuhu",password:"KAKSYAKA",selected:"0",completed:"0"},

    ];

jQuery("#list").jqGrid({
        cellEdit:true,
        cellsubmit: "clientArray",
        editurl:'clientArray',    
        datatype: "local",
        loadonce: true,
        data: grid_data,
        gridview:true,
        rowNum: 20,
        //scroll:1,
        height: '100%',
        viewrecords: true,
        colNames:['id','whoaaa','KO','First Name','Last Name','Username','Password','Selected','Completed'],
        colModel:[
            {name:'id',index:'id',width:60,sorttype:"int",hidden:true},            
            {name:'whoaaa',index:'whoaaa',width:90,sorttype:"text"},
            {name:'pr',index:'pr',width:30,sorttype:"int"},
            {name:'first_name',index:'first_name',width:100,sorttype:"text",editable:true},
            {name:'last_name',index:'last_name',width:100,sorttype:"text",editable:true},
            {name:'username',index:'username',width:100,align:"right",sorttype:"text",editable:true},
            {name:'password',index:'password',width:100,align:"right",sorttype:"text",editable:true},
            {name:'selected',index:'selected',width:90,editable:true, edittype:'checkbox', editoptions: { value:"1:0"},  formatter: "checkbox", formatoptions: {disabled : false},sorttype:"text",searchoptions: { sopt: ['eq'], value:":All;1:Yes;0:No" }, stype: 'select',sortable:true},
            {name:'completed',index:'completed',width:100,editable:true, edittype:'checkbox', editoptions: { value:"1:0″},  formatter: "checkbox", formatoptions: {disabled : false},sorttype:"text",searchoptions: { sopt: ['eq'], value:":All;1:Yes;0:No" }, stype: 'select', sortable:true},
            ],
        multiselect: true,
        filterToolbar: true,
        height: "200″,
        //toolbar:[true,"both"],
        pager: "#pager",
        caption: "Accounts" });

    
        jQuery("#list").jqGrid('navGrid','#pager',
        {view:false,add:false,del:false}
        ).jqGrid('navButtonAdd', '#pager',{id:"showhide",caption:"Show/Hide Columns"});
        
        jQuery("#showhide").click(function() {
           jQuery("#list").setColumns();
           return false;
        });
        
        jQuery("#list").jqGrid('filterToolbar', {autosearch:true});
        //$("#list").searchGrid({ } );
        
        jQuery("#scc").click( function() {
            //alert('click');
            var rowdata= $("#list").jqGrid('getRowData');
            //alert(rowdata);
            var rowdataString = JSON.stringify(rowdata);
            alert(rowdataString);
            //console.log(rowdata);
            $("#list").setRowData(1,{first_name:"HUHAHUA"});
            });         
});
 
</script>

 
</head>
<body>

<table id="list"></table>
<div id="pager"></div>

<a href="javascript:void(0)" id="scc">Change value</a>
</body>
</html>

16/01/2011
16:34
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You can do it reading carefully the docs.

You already have a

 data: grid_data,

grid_data is array which elements can be accesed easy.

Just for the record

var mysearchelement;

$.each(grid_data, function(){

if(this.id=="the_id_that_i_want_to_serch){

mysearchelement = this;

return false;

}

})

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/01/2011
16:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Please do not post similar questions several times.

Thank you

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/01/2011
16:42
Avatar
giorgio79
Member
Members
Forum Posts: 24
Member Since:
14/01/2011
sp_UserOfflineSmall Offline

Thanks Tony, I tried but grid_data contains the startup values, but it does not contain any changes made to it via editing in the grid.

16/01/2011
16:49
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

You are wrong Giorgio!

The object accessible under the data parameter contain current local data saved in the jqGrid inclusive all modification of local data which are already saved.

Best regards
Oleg 

16/01/2011
16:52
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Then your question should be quite diffrent. Right?

This is not true. Tell me how you try to do it?

SetCell method and setRowData used in celEdit and inline edit affect correctly the array data.

Please check your code again

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/01/2011
17:00
Avatar
giorgio79
Member
Members
Forum Posts: 24
Member Since:
14/01/2011
sp_UserOfflineSmall Offline

Guys, first and foremost thanks for your patience.

Oleg: I would LOVE to be wrong 🙂

Tony: In the same example that I posted, just replace the scc button call with this to get grid_data edit some value, although I do change a cell programmatically. But it has no effect. Just recording a video, so you can see.

        jQuery("#scc").click( function() {
            $("#list").setRowData(1,{first_name:"HUHAHUA"});

            var rowdataString = JSON.stringify(grid_data);
            alert(rowdataString);

            });    

16/01/2011
17:18
Avatar
giorgio79
Member
Members
Forum Posts: 24
Member Since:
14/01/2011
sp_UserOfflineSmall Offline

Here is a live url for testing ( I am using Firefox 3.6):

http://s53452.gridserver.com/j....._test.html

The "Change value" under the grid does an alert for grid_data and it is unchanged :(

and here is the video

(The conversation topic did change from getRowData, but it seems the topic is locked :) )

16/01/2011
19:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

It seems you do not read the docs and post in this forum.

THE GRID SHOULD HAVE UNIQUIE ID.

Topic closed for me.

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/01/2011
20:22
Avatar
giorgio79
Member
Members
Forum Posts: 24
Member Since:
14/01/2011
sp_UserOfflineSmall Offline

Thanks Tony.

The grid has a unique HTML id "#list".

However, I noticed the grid rows have a column called "id" as well that have repeating numbers!

These need to be unique as well for "data" param to work

I was under the impression rowids are internal unless I set a "key" column as per the docs? 

So it seems there is a bug, namely that "id" column name should not be used.

Giving id rows inside the array unique values DID solve the problem.

Thanks

PS

It seems like this is a bug, and others stumbled on it as well:

http://stackoverflow.com/quest.....uring-save

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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