telerik - Cannot read property 'length' of null: using `sender.set_selectedToggleStateIndex(val)` within a nested function that is used as a radprompt callback -
i'm getting "typeerror: cannot read property 'length' of null" when calling sender.set_selectedtogglestateindex(val)
within nested function used radprompt callback.
sender radbutton (buttontype = toggle; toggletype = customtoggle).
although may not relevant: radbutton initiated in radgrid via custom gridtemplatecolumn.
ontogglevaluechangingresulthandler = function (sender, e, args, result) { if ((result) ? result.isvalid : false) { homecoming true; } else { if (result.statuscode == 200) { radprompt(result.message, ontogglevaluechangingpromptcallbackfn, 400, 350, null, result.title || "prompt - override", false); } else { radalert(result.message || "internal error occurred!", 400, 350, result.title || "alert - error", null, null); } homecoming false; } function ontogglevaluechangingpromptcallbackfn(promptargs) { promptargs = promptargs || { "override": false, "note": "" }; if (promptargs.override && promptargs.note.length > 0) { args.override = promptargs.override; args.overridenote = promptargs.note; var result = paysheet.xhr.post(args._uri, args); result.isvalid = true; if ((result) ? result.isvalid : false) { // $find(sender.id).set_selectedtogglestateindex(args.newindex); sender.set_selectedtogglestateindex(args.newindex); } else { if (result.statuscode == 200) { radalert(result.message || "override request denied!", 400, 350, result.title || "alert - override denied", null, null); } else { radalert(result.message || "internal error occurred!", 400, 350, result.title || "alert - error", null, null); } } } else { // ensuring command retains same value; prompt async; } } }
this pattern seems work radcombobox , series of radtextboxes. additionally, eventargs seem more robust.
i suspect issue rooted in clientstate persistence , referencing: controlstates and/or viewstate beingness lossed.
if effort phone call sender.get_selectedtogglestate()
or sender.get_selectedtogglestateindex()
in promptcallbackfn, error stating this._functionality undefined. _functionality seems in regards controlstate.
note:
sender.get_clientstatefieldid()
returns clientid properly, $find(sender.get_clientstatefieldid())
returns null
.
sender.get_togglestatedata()
returns info properly. sender.get_togglestates()
returns null
.
sender.get_parent()
returns null.
the reply turned out to set autopostback = false
of radbutton.
such minor oversight.
the postback went unnoticed me because of nature of these controls.
telerik
No comments:
Post a Comment