ASP.NET MVC中XML的Kendu菜单

时间:2018-06-22 07:34:43

标签: xml model-view-controller kendo-ui menu

我有XML数据源,需要使用ASP.NET MVC创建Kendo菜单。请帮忙!

Dnyanesh

1 个答案:

答案 0 :(得分:0)

获得动态生成的Kendo UI菜单小部件的唯一方法是使用Kendo数据源对其进行初始化。您可以将JavaScript对象数组或远程XML,JSON,JSONP数据绑定到数据源,然后动态初始化Kendo UI菜单。

这里是一个示例:http://jsfiddle.net/D54eM/

以下是数据的示例:

                 <table class="table table-sm">
                        <thead>
                          <tr>
                            <th scope="col">Jour</th>
                            <th scope="col">Pause</th>
                            <th scope="col">Ouvert de</th>
                            <th scope="col">à</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <th scope="row" rowspan="2">Lundi</th>
                            <td>Matin</td>
                            <td><input type="text" class="form-control" name="hours[0][0][open_at]" value="{{ $hours[0][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[0][0][closed_at]" value="{{ $hours[0][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[0][1][open_at]" value="{{ $hours[0][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[0][1][closed_at]" value="{{ $hours[0][1][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>
                            <th scope="row" rowspan="2">Mardi</th>
                            <td>Matin</td>
                            <td><input type="time" class="form-control" name="hours[1][0][open_at]" value="{{ $hours[1][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[1][0][closed_at]" value="{{ $hours[1][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[1][1][open_at]" value="{{ $hours[1][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[1][1][closed_at]" value="{{ $hours[1][1][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>
                            <th scope="row" rowspan="2">Mercredi</th>
                            <td>Matin</td>
                            <td><input type="time" class="form-control" name="hours[2][0][open_at]" value="{{ $hours[2][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[2][0][closed_at]" value="{{ $hours[2][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[2][1][open_at]" value="{{ $hours[2][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[2][1][closed_at]" value="{{ $hours[2][1][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>
                            <th scope="row" rowspan="2">Jeudi</th>
                            <td>Matin</td>
                            <td><input type="time" class="form-control" name="hours[3][0][open_at]" value="{{ $hours[3][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[3][0][closed_at]" value="{{ $hours[3][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[3][1][open_at]" value="{{ $hours[3][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[3][1][closed_at]" value="{{ $hours[3][1][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>
                            <th scope="row" rowspan="2">Vendredi</th>
                            <td>Matin</td>
                            <td><input type="time" class="form-control" name="hours[4][0][open_at]" value="{{ $hours[4][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[4][0][closed_at]" value="{{ $hours[4][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[4][1][open_at]" value="{{ $hours[4][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[4][1][closed_at]" value="{{ $hours[4][1][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>
                            <th scope="row" rowspan="2">Samedi</th>
                            <td>Matin</td>
                            <td><input type="time" class="form-control" name="hours[5][0][open_at]" value="{{ $hours[5][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[5][0][closed_at]" value="{{ $hours[5][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[5][1][open_at]" value="{{ $hours[5][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[5][1][closed_at]" value="{{ $hours[5][1][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>
                            <th scope="row" rowspan="2">Dimanche</th>
                            <td>Matin</td>
                            <td><input type="time" class="form-control" name="hours[6][0][open_at]" value="{{ $hours[6][0][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[6][0][closed_at]" value="{{ $hours[6][0][0]['closed_at'] }}"></td>
                          </tr>
                          <tr>    
                            <td>Après-midi</td>
                            <td><input type="time" class="form-control" name="hours[6][1][open_at]" value="{{ $hours[6][1][0]['open_at'] }}"></td>
                            <td><input type="time" class="form-control" name="hours[6][1][closed_at]" value="{{ $hours[6][1][0]['closed_at'] }}"></td>
                          </tr>    
                        </tbody>
                      </table>   

下面的链接提供了一些有关Kendo数据源的有用文档:

http://docs.telerik.com/kendo-ui/getting-started/framework/datasource/overview