This is a migrated thread and some comments may be shown as answers.

anchor click not detected on ie9

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Danish
Top achievements
Rank 1
Danish asked on 07 Feb 2012, 12:21 PM
Hi, 

I am creating a grid using row templates with custom upload and download buttons for individual rows.These buttons are anchor links with their class set to k-button. I am attaching a click handler to these buttons using the jquery delegate function. My code runs fine in chrome but when I try it ie9 nothing happens when I click the buttons. The weird thing is if start developer tools (by pressing F12) everything starts running fine. Can anyone explain what may be causing this issue. I am using the jquery.js files provided with kendo.

Code excerpts for reference as shown below
<!-- HTML code -->
<table id="grid">     
    <thead>
        .....
    </thead>            
</table> 

<script id="rowTemplate" type="text/x-kendo-tmpl">
    <tr >
        ..
        <td>                        
            <a id="delete" class='k-button' data-event="delete"><span class='k-icon k-delete'>Delete</span></a>
            <a id="download" class='k-button' data-event="download"><span class='k-downloadicon'>Download</span></a>                                </td>
    </tr>
</script>

 <script type="text/javascript">

    $(function () {        
        $(document).ready(function () {
            
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        ...
                    },                    
                    destroy: {
                        ...
                    }
                },                
                ....
            });

            $("#grid").kendoGrid({
                dataSource: dataSource,                
                rowTemplate: kendo.template($("#rowTemplate").html()),
                ...
            });

            $(document).delegate(".k-button", "click", function (e) {
                var that = $(this),
                eventData = that.data("event");
                if (eventData != null) {
                    _clickHandlers[eventData](e);
                }
            });


            _clickHandlers = {


                "delete": function (event) {
                    console.log("delete");
                    ....
                },
                "download": function (event) {
                    console.log("download");
                    .....
                } 
            }

        });
    });
</script>


3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 07 Feb 2012, 01:29 PM
Hello Danish,

IE will complain if you have console.log in your javascript and haven't opened the developer tools.

Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Danish
Top achievements
Rank 1
answered on 09 Feb 2012, 07:12 AM
Thanks Nikolay, commenting out all console.log commands has seemed to resolve the issue. I wish there was some sort of indication in ie. So is there a way to keep the console.log commands in my code and not mess with ie 9, I dont want to add any browser specific changes.

Danish
0
Joel
Top achievements
Rank 1
answered on 16 Feb 2012, 09:05 PM
Use this to mute log calls when the console's not defined:

// Console global variable fix for IE
if (typeof window.console === "undefined") {
    window.console = {
        log: function () {
        }
    };
}
Tags
Grid
Asked by
Danish
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Danish
Top achievements
Rank 1
Joel
Top achievements
Rank 1
Share this question
or