English 中文(简体)
Jqgrid在使用继器时将注意力集中在目前的电池上。
原标题:Jqgrid keep focus on current cell when using editrules

First, I m going to be submitting a couple of different questions that relate to the code snippet posted here. So, if you see other questions and think "hey, that s a duplicate, I ve seen that code" it really isn t. I want to be sure to credit each answerer for the distinctly different questions. Here s one: I have the following jqgrid, and I m trying to change the masking from "__" to "00" when the user only enters the first half of the field. The method gets called, the value changed, but it still displays the old value. I m using jqgrid version 4.2. Grid:

WorkSchedule.prototype.init = function() {
        var self = this;
        self.jqgridParms = {
            datatype: "local",
            height:  auto ,
            width: 700,
            colNames: ["Week", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Total"],
            colModel: [// very much dummy stuff here.
                        {name: "Week", index: "Week", width: 50, editable: false },
                       { name: "Sun", index: "Sun", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                           dataInit: function(elem) {
                               $(elem).mask("99:99");
                           }
                       }, align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                       },
                        { name: "Mon", index: "Mon", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                            dataInit: function(elem) {
                                $(elem).mask("99:99");
                            }
                        }, align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                        },
                        { name: "Tues", index: "Tues", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                            dataInit: function(elem) {
                                $(elem).mask("99:99");
                            }
                        },
                            align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                        },
                        { name: "Wed", index: "Wed", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                            dataInit: function(elem) {
                                $(elem).mask("99:99");
                            }
                        },
                            align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                        },
                        { name: "Thurs", index: "Thurs", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                            dataInit: function(elem) {
                                $(elem).mask("99:99");
                            }
                        },
                            align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                        },
                        { name: "Fri", index: "Fri", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                            dataInit: function(elem) {
                                $(elem).mask("99:99");
                            }
                        },
                            align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                        },
                        { name: "Sat", index: "Sat", width: 85, editable: true, edittype: "text", editoptions: { size: 20, maxlength: 30,
                            dataInit: function(elem) {
                                $(elem).mask("99:99");
                            }
                        },
                            align: "center", formatter: timeEntryFormat, editrules: { custom: true, custom_func: validHourEntry }
                        },
                        { name: "WeekTotal", index: "WeekTotal", width: 55, editable: true, align: "center" }
                      ],
            multiselect: false,
            caption: "Manage Work Schedule",
            rowNum: 10,
            cellEdit: true,
            gridComplete: function() {
                calculateTotal();
            },
            beforeSaveCell: function(rowid,cellname,value,iRow,iCol) {
            formatFromMask(rowid, cellname, value, iRow, iCol);
            },
            afterSaveCell: function() {
                calculateTotal();
            },
            cellsubmit: "clientArray"
        }
}



 function formatFromMask(rowid, cellname, value, iRow, iCol) {
            if (typeof value !== "undefined") {
                value = value.replace(/_/g, "0");
return value;
            }
        }
最佳回答

Ok, I found the simple answer, which is to set the mask to "00:00". It brings up a separate issue, but solves the problem here.

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签