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
Client-side only updates
17/02/2010
17:19
Avatar
paulm
New Member
Members
Forum Posts: 2
Member Since:
17/02/2010
sp_UserOfflineSmall Offline

I'm trying to set-up a grid which only does client-side editing (no Ajax back to the server). The data is loaded via Ajax and I've set cellsubmit: 'clientArray' - however, if I leave editurl empty it gives me an error about the Url being required. If I fill it in with an empty page, it "appears" to work. But if you do something like:

- Add new record

- Select record you just added and click on Edit

- Edit the record / click Save.

The client-side record isn't changed.

Here's what the code looks like:

<script>

    $(document).ready(function () {

        $("#grdInvoice").jqGrid({
            url: 'InvoiceHandler.ashx?Method=GetInvoice',
            datatype: "json",
            colNames: ['Category', 'Part #', 'Description', 'Cost', 'PK'],
            colModel: [
                { name: 'Category', index: 'Category', width: 110, editable: true, edittype:"select", editoptions: "A:One;B:Two" },
                { name: 'PartNumber', index: 'PartNumber', width: 170, editable: true, editoptions: { size: 20} },
                { name: 'Description', index: 'Description', width: 200, editable: true, editoptions: { size: 30} },
                { name: 'Cost', formatter: 'currency', align: "right", formatoptions: { prefix: "$" }, index: 'Cost', width: 95, editable: true, editoptions: { size: 10} },
                { name: 'PK', hidden: true, editable: false}
            ],
            caption: "Invoice",
            viewrecords: true,            
            cellsubmit: 'clientArray',
            editurl: "InvoiceHandler.ashx?Method=Nothing"
        });

        $("#btnAdd").click(function () {
            $("#grdInvoice").jqGrid('editGridRow', "new", { reloadAfterSubmit: false });
        });

        $("#btnEdit").click(function() {
            var selRow = $("#grdInvoice").jqGrid("getGridParam", "selrow");
            if (selRow != null)
                $("#grdInvoice").jqGrid("editGridRow", selRow);
            else
                alert("Please select a row.");

        });

        $("#btnDelete").click(function() {
            var selRow = $("#grdInvoice").jqGrid("getGridParam", "selrow");
            if (selRow != null)
                $("#grdInvoice").jqGrid("delGridRow", selRow);
             else
                alert("Please select a row.");
        });
    });
    </script>

20/02/2010
11:54
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Just checked this. No problem. The only thing that can happen here is that if you add a record this way the method add a id which is totalrecords in page + 1. This way it is quite possible that there is a duplicate id.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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