how to override KendoListView function! Urgent Please!

2 posts, 0 answers
  1. ScholarisPM
    ScholarisPM avatar
    11 posts
    Member since:
    Feb 2007

    Posted 11 Nov 2013 Link to this post

    Hi Support Team,

    I had a big issue when using KendoListView function on windows 8 platform. The issue is window 8 platform doesn't allow us add dynamic html that contain unsafe code. 

    I made a search and found out this link:

    This is extracting from the article:
    "Dynamically adding HTMLA page
    in your app's local context has more access to the system than other Web pages (or "Web-context pages") do. It can access the Windows Runtime and, depending on the app's permissions, might be able to access the file system and your devices. For this reason, it's important to prevent potentially malicious code from executing.To guard against script injections and help shield your system from potentially malicious code, HTML you inject into a page in the local context is filtered as though it was processed by the toStaticHTML method. Injecting HTML that contains an unknown element, event handler, script or reference to script, or unknown CSS pseudo-element and pseudo-class causes an exception when you try to add the HTML to the page's DOM."

    We can work around by placing the block of code in the function MSApp.execUnsafeLocalFunction as following:
    MSApp.execUnsafeLocalFunction(function () {
                            var listView = $("#listView").kendoListView({
                                dataSource: localDataSource,
                                selectable: 'single',
                                template: kendo.template($("#CountryListView_template").html())

    But this method is not good as we must change code of the whole process to make it work. So I need to override the kendoListView function to make it affect for the whole project without much code changes.

    I tried this one:

     _kendoListView = $.fn.kendoListView;
     $.fn.kendoListView = function (i) {
           var _this = this;
            MSApp.execUnsafeLocalFunction(function () {
                _kendoListView.apply(_this, arguments);

    But it doesn't work. Would you please help me how to override this function above. i just want to add the code MSApp.execUnsafeLocalFunction before call KendoListView function. 

    Thanks and Best Regards,

  2. Alexander Valchev
    Alexander Valchev avatar
    2895 posts

    Posted 13 Nov 2013 Link to this post

    Hello ScholarisPM,

    I suggest you to use the call method. For example:
    _kendoListView = $.fn.kendoListView;
    $.fn.kendoListView = function(options) {
        var that = this;
        setTimeout(function() {
  , options);
        }, 300);

    Please change the setTimeout with the required for your case method and give it a try.

    Alexander Valchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top