javascript更改kendo网格的数据源

时间:2017-02-19 09:41:03

标签: javascript asp.net-mvc kendo-grid

       $('#kgrid').data("kendoGrid").dataSource.read({ GridTybe: Grid1Tybe, DataTybe: Data1Tybe, DateFrom: datefrom, DateTo: dateto });

    }
    else {



           var Data11Tybe = 1
           $('#kgrid').data("kendoGrid").dataSource.read({ GridTybe: Grid1Tybe, DataTybe: Data11Tybe, FromCode: codeFrom, ToCode: codeTo });



    }
}

剑道网格配置如下:

 <%= Html.Kendo.Grid(CType(Model, List(Of MCOnline.Sales))).Name("grd").HtmlAttributes(New With {.id = "kgrid"}) _
.Columns(Function(s) s.Bound(Function(bound) bound.amount).Title("صافى القيمة").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:center"})) _
.Columns(Function(D) D.Bound(Function(bound) bound.discount).Title("خصومات").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:right"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(w) w.Bound(Function(bound) bound.additions).Title("اضافات").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(q) q.Bound(Function(bound) bound.salestaxes).Title("ضريبة مبيعات").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(z) z.Bound(Function(bound) bound.GrandTotal).Title("قيمة الاصناف").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:center"})) _
.Columns(Function(s) s.Bound(Function(bound) bound.AccountName).Title("اسم الحساب").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:center"})) _
.Columns(Function(D) D.Bound(Function(bound) bound.store).Title("اسم المخزن").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:right"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(w) w.Bound(Function(bound) bound.movedateStr).Title("تاريخ الاستحقاق").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(q) q.Bound(Function(bound) bound.sidecode).Title("امر بيع").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(z) z.Bound(Function(bound) bound.movedateStr).Title("التاريخ").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.class = "k-rtl"})) _
.Columns(Function(z) z.Bound(Function(bound) bound.code).Title("رقم الاذن").Width("50px").HeaderHtmlAttributes(New With {.style = "text-align:center"}).HtmlAttributes(New With {.style `enter code here`= "text-align:center"})) _
     .Columns(Function(e) e.Bound(Function(g) g.serial).Title("").Sortable(False).Filterable(False).ClientTemplate("<a class='btn btn-warning' href='#=url#' target='_blank' >فاتورة</a>")) _
.Sortable().ClientDetailTemplateId("template").HtmlAttributes(New With {.class = "k-rtl"}).Filterable().HtmlAttributes(New With {.style = " width:100%;  overflow-x:scroll;"}).Selectable().Groupable().DataSource(Function(c) c.Ajax().ServerOperation(False).Read(Function(r) r.Action("FillGrid", "Sales", New With {.GridTybe = 0, .DataTybe = 0, .DateFrom = Now.Date.AddDays(-30).ToString("yyyy/MM/dd"), .DateTo = Now.Date.ToString("yyyy/MM/dd")})))%>

显示错误Uncaught TypeError: Cannot read property 'dataSource' of null

请指导我做错了什么。

0 个答案:

没有答案