I'm defining a window in Asp.net mvc with following:
@(Html.Kendo().Window()
.Name("staffsec")
.Title("Edit")
.Actions(a => a.Minimize().Maximize().Close())
.Content("")
.Modal(true)
.Visible(false)
.Width(440)
.Height(500)
.Scrollable(true)
.Position(settings =>
settings.Top(50).Left(300))
)
And using follwing Java Script to load the window
Issue is, window is displayed only first time i click. Next time i click i get error on console that 'windowk' is undefined. I've used the same technique on different form, there is no issue.
Words of wisdom will be appreciated..
Abdul Rehman
@(Html.Kendo().Window()
.Name("staffsec")
.Title("Edit")
.Actions(a => a.Minimize().Maximize().Close())
.Content("")
.Modal(true)
.Visible(false)
.Width(440)
.Height(500)
.Scrollable(true)
.Position(settings =>
settings.Top(50).Left(300))
)
And using follwing Java Script to load the window
var
staffId =
'@Html.Raw(Json.Encode(Model.StaffModel.StaffId))'
;
var
windowk = $(
"#staffsec"
).data(
"kendoWindow"
);
windowk.refresh({< url:
"@Url.Content("
/StaffSecurity/Index/
")"
, data: { id: staffId });<br>windowk.title(
"Staff Security"
); windowk.open();
return
event.preventDefault();
Issue is, window is displayed only first time i click. Next time i click i get error on console that 'windowk' is undefined. I've used the same technique on different form, there is no issue.
Words of wisdom will be appreciated..
Abdul Rehman
5 Answers, 1 is accepted
0
Abdul
Top achievements
Rank 1
answered on 17 Jul 2014, 12:32 PM
Also, If i'm using the Window without defining (with a div), How to specify its Refresh property to dynamically load a view
It seems to work here:
but does not work with this sort of defination:
Kindly advise
It seems to work here:
windowk.refresh({< url:
"@Url.Content("
/StaffSecurity/Index/
")"
, data: { id: staffId });
refresh: { url:
'@Url.Content("~/StaffSecurity/Index/")'
, data: { id: staffId } },
Kindly advise
0
Hi Abdul,
Concerning the first question, I suspect that the Window loads a new jQuery instance, which deletes all existing jQuery pluings on the page (including Kendo UI widgets).
http://docs.telerik.com/kendo-ui/getting-started/web/window/overview#loading-window-content-via-ajax
http://docs.telerik.com/kendo-ui/getting-started/troubleshooting#javascript-error-that-kendo-widgets-are-unavailable-or-undefined
Concerning the second question, please do not confuse the refresh method, the refresh event and the content property.
http://docs.telerik.com/kendo-ui/api/web/window#configuration-content
Regards,
Dimo
Telerik
Concerning the first question, I suspect that the Window loads a new jQuery instance, which deletes all existing jQuery pluings on the page (including Kendo UI widgets).
http://docs.telerik.com/kendo-ui/getting-started/web/window/overview#loading-window-content-via-ajax
http://docs.telerik.com/kendo-ui/getting-started/troubleshooting#javascript-error-that-kendo-widgets-are-unavailable-or-undefined
Concerning the second question, please do not confuse the refresh method, the refresh event and the content property.
http://docs.telerik.com/kendo-ui/api/web/window#configuration-content
Regards,
Dimo
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Abdul
Top achievements
Rank 1
answered on 19 Jul 2014, 08:45 PM
Hi Demo! Thank you for your reply..
Before i walk you thru the issue, let me update you i did some experiments. Page works fine if loaded without Kendo window (a normal page). secondly, if i enable Iframe in winddw decleration .. it runs like a bullet .. no issue
Let me give you actual scenario... What is happening is that i'm loading a complete view in Kendo window (using Partial view). The view contains a Kendo grid inside of it..
Now that's what happens.. When i load it.. it loads the grid without loading the data and prompts error message on console that "Event Handlers are not defined". Those are properly defined and functional and part of grid functionality for AutoSync. If i comment out Event handlers in Kendo decleration. It loads the data but it does not provide the functionality i need.
I did another experiment that I add Jquery Library/Kendo references in the view. Its only if i add both, It loads the kendo grid without any issue Except that if i click it again, it does not recognize the window object as mentioned in earlier post
All apart, works like a charm if i enable iFrame.
Can you throw some light?
Before i walk you thru the issue, let me update you i did some experiments. Page works fine if loaded without Kendo window (a normal page). secondly, if i enable Iframe in winddw decleration .. it runs like a bullet .. no issue
Let me give you actual scenario... What is happening is that i'm loading a complete view in Kendo window (using Partial view). The view contains a Kendo grid inside of it..
Now that's what happens.. When i load it.. it loads the grid without loading the data and prompts error message on console that "Event Handlers are not defined". Those are properly defined and functional and part of grid functionality for AutoSync. If i comment out Event handlers in Kendo decleration. It loads the data but it does not provide the functionality i need.
I did another experiment that I add Jquery Library/Kendo references in the view. Its only if i add both, It loads the kendo grid without any issue Except that if i click it again, it does not recognize the window object as mentioned in earlier post
All apart, works like a charm if i enable iFrame.
Can you throw some light?
0
Abdul
Top achievements
Rank 1
answered on 19 Jul 2014, 09:43 PM
writing just to make sure I'm not misleading you.. Iframe also only works if i add Jquery and kendo references in the view.
I do understand that an additional jquery in the view is doing the damage, but not so sure how to circumvent it as if i don't add references it does not provide kendo grid functionality...
I do understand that an additional jquery in the view is doing the damage, but not so sure how to circumvent it as if i don't add references it does not provide kendo grid functionality...
0
Hello Abdul,
I am a little confused. It seems there are two separate problems - the duplicate jQuery registration causes the Window to fail, while a possible incorrect event handler implementation causes the event handler to fail. Are you saying that when the Window widget works, the Grid event handler does not work? Are you sure that the event handler functions are defined in a scope, which is available at the time the Grid inside the Window is initialized?
In case you need further assistance, please provide some simple runnable example, so that I can take a look at it and avoid the guesswork.
Regards,
Dimo
Telerik
I am a little confused. It seems there are two separate problems - the duplicate jQuery registration causes the Window to fail, while a possible incorrect event handler implementation causes the event handler to fail. Are you saying that when the Window widget works, the Grid event handler does not work? Are you sure that the event handler functions are defined in a scope, which is available at the time the Grid inside the Window is initialized?
In case you need further assistance, please provide some simple runnable example, so that I can take a look at it and avoid the guesswork.
Regards,
Dimo
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.