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
Losing cell edits when paging with local data.
16/11/2010
19:17
Avatar
WarrenW
New Member
Members
Forum Posts: 1
Member Since:
16/11/2010
sp_UserOfflineSmall Offline

Hi.

I'm either missing something or I've found a bug in cell editing when using paging with local datatype.  Could someone help me see why this isn't working?  Here's an example of my grid that has two rows, 7 columns, and 2 pages.

<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />

<link href="style/common.css" rel="stylesheet" type="text/css" />
<link href="style/redmond/jquery-ui-1.8.5.custom.css" rel="stylesheet" type="text/css" />
<link href="style/ui.jqgrid.css" rel="stylesheet" type="text/css" />

<script src="script/jquery-1.4.2.js" type="text/javascript"></script>
<script src="script/jquery-ui-1.8.5.custom.js" type="text/javascript"></script>
<script src="script/grid.locale-en.js" type="text/javascript"></script>
<script src="script/jquery.jqGrid-3.8.1.min.js" type="text/javascript"></script>

</head>

<body>
<table id="grid"></table>
<div id="gridnav"></div>

<script>
$(function() {

var colModel = [];
colModel.push({
    align: "center",
    label : "Cat.",
    name : "cat",
    sortable: false
});

colModel.push({
    hidden : true,
    name : week
});

for (var i = 0; i < 7; i++) {
    colModel.push({
        align : "center",
        editable: true,
        editrules: {number: true},
        label: "day" + i,
        name : "day" + i,
        sortable: false
    });
}

var category = [ "A", "B" ];

var data = [];

for (var week = 0; week < 2; week++) {
    $.each(category, function(index, shift) {
        var rowdata = { cat : category[index], week: week };
        for (var day = 0; day < 7; day++) {
            rowdata["day"+day] = ""+week;
        }
        data.push(rowdata);
    });
}

var grid = $('#grid');
var gridnavref = '#gridnav';

grid.jqGrid({
    caption: "Sample",
    cellEdit: true,
    cellsubmit: "clientArray",
    colModel: colModel,
    data: data,
    datatype: "local",
    hidegrid: false,
    pager: gridnavref,
    pgtext: "week {0} of {1}",
    rowNum: 2
});

});

</script>

</body>

</html>

If you go to each page, you can see the data is populated with all 0's for the first page and all 1's for the second page.  If you try editing one of the cells, you'll see that the data is edited just fine as long as you stay on the page.  If you go to the other page and back to the original page, you'll see that all the edits are gone.  Reading some previous posts, I've tried with and without the trigger("reload") and I'm getting the same problem.  Can someone tell me what's wrong?  Am I missing an option?  Am I not populating the data array properly?

Thanks.

Warren

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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