如何在Kendo UI中模拟事件

时间:2014-04-17 20:31:35

标签: javascript kendo-ui

我想在页面加载时模拟更改事件,但我尝试了一些事情并且没有任何作用(:

jQuery(function($){

                        var data = $('[name="carriage"]').data('kendoDropDownList');
                        data.setOptions({
                            'change':function(v) {
                                $('[id^="carriageWindow"]').css('display','none');
                                $('#carriageWindow' + v.sender.value()).css('display','block');
                            }
                        });
                        data.select(1); //not works
                        data.bind("change"); //not works

                        data.change(); //not works

                    });

1 个答案:

答案 0 :(得分:2)

试试这个:

// select second option
data.select(1);

// trigger change event
data.trigger('change');

演示:http://plnkr.co/edit/fqhBSf5VU0SD6STiCgpY?p=preview