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
celledit + checkbox needs an "ENTER" pressed for saving state
16/01/2011
10:27
Avatar
giorgio79
Member
Members
Forum Posts: 24
Member Since:
14/01/2011
sp_UserOfflineSmall Offline

Hello,

I am having an issue that is very similar to an old bug:

http://www.trirand.com/blog/?p.....-jqgrid-36

1. Click on cell with content Yes

2. Change the value from checked to unchecked

3. Press Enter to save it

evarthing correct.

But this not work (bug)

1. Click on cell with content Yes

2. Change the value from checked to unchecked

3. "CLICK ANOTHER CELL"

The difference is that I am using a checkbox formatter for display, not just for edit like this

            {name:'selected',index:'selected',classes:"192-haha",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},

The same happens:

1. Click on checkbox

2. Click inside the cell of the checkbox to highlight with celledit

3. Press Enter to save

Works fine

But this does not

1. Click on checkbox to change value

2. Click somewhere else

3. Do a sort or filter -> Checkbox loses the change

Here is the full code, that I posted in another thread before:

http://www.trirand.com/blog/?p.....reservedi/

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

I think my issue is a duplicate of this:

http://www.trirand.com/blog/?p.....38;ret=all

15/07/2011
18:20
Avatar
timeriver
Member
Members
Forum Posts: 6
Member Since:
15/07/2011
sp_UserOfflineSmall Offline

I had done this, share with you :

$(document).ready(function () {
         $.ajax({
             url: 'sheet.aspx?q=load',
             datatype: 'json',
             success: function (data) {
                 $("#grid_id").jqGrid({
                     url: '',
                     datatype: 'clientSide',
                     mtype: 'POST',
                     height: 'auto',
                     colNames: data.colNames, //get from code behide
                     colModel: data.colModel, //get from code behide
                     viewrecords: true,
                     rowNum: 15,
                     headtitles: true,
                     data: data.rows,
                     jsonReader: {
                         root: "rows"
                     },
                     hidegrid: false,
                     cellurl: 'sheet.aspx?q=update',
                     beforeSubmitCell: function (rowid, celname, value, iRow, iCol) {
                         return { celname: celname }
                     },
                     loadError: function (xhr, status, error) { alert(status + " " + error); }
                 });

                 jQuery(".jqgrow td input").each(function () {  //detect all input
                     jQuery(this).click(function () {
                         jQuery(this).change(function () {
                             var data = new Array(3);
                             data[0] = "{id:\"" + $(this).parents('tr').attr('id').replace(/^\s*|\s*$/g, "") + "\","; // replace = trim
                             var colname = $(this).parents('td').attr('aria-describedby').replace("grid_id_", ""); // get colname
                             var value = ($(this).prop('checked')) ? "True" : "False";
                             data[1] = colname + ":\"" + value + "\",";
                             data[2] = "celname:\"" + colname + "\"}"
                             $.ajax({
                                 url: 'sheet.aspx?q=update',
                                 type: 'POST',
                                 data: eval('(' + data[0] + data[1] + data[2] + ')'),  //eval is string to json
                                 beforeSend: function (jqXHR, textStatus) { jQuery('#grid_id').block({ message: '<h1>Loading...</h1>' }); },
                                 complete: function (jqXHR, textStatus) { jQuery('#grid_id').unblock(); },
                                 loadError: function (xhr, status, error) { alert(status + " " + error); }
                             });
                         });
                     });
                 });
             },
             error: function (x, e) {
                 alert(x.readyState + " " + x.status + " " + e.msg);
             }
         });
     });

colmodel: "{"name":"test","width":40,"align":"center","editoptions":{"value":"True:False"},"edittype":"checkbox","formatter":"checkbox","formatoptions":{"disabled":false}},"

these code can ajax save the checkbox state.

17/07/2011
20:14
Avatar
kobruleht
Member
Members
Forum Posts: 144
Member Since:
05/05/2011
sp_UserOfflineSmall Offline

I tried but got error that block() method is undefined. How to fix ?

18/07/2011
11:38
Avatar
timeriver
Member
Members
Forum Posts: 6
Member Since:
15/07/2011
sp_UserOfflineSmall Offline

kobruleht said:

I tried but got error that block() method is undefined. How to fix ?


the block is blockUI function, try to google how to use it.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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