1

我只是在玩 kendo-ui-vue,但我遇到了一件简单的事情,但我不知道如何让它工作。

我只是从页面中获取示例并进行了一些修改,所以我将粘贴来自 Kendo 的代码。

<div id="vueapp" class="vue-app">
<kendo-datasource ref="datasource1"
                    :transport-read-url="'https://demos.telerik.com/kendo-ui/service/Products'"
                    :transport-read-data-type="'jsonp'"
                    :transport-update-url="'https://demos.telerik.com/kendo-ui/service/Products/Update'"
                    :transport-update-data-type="'jsonp'"
                    :transport-destroy-url="'https://demos.telerik.com/kendo-ui/service/Products/Destroy'"
                    :transport-destroy-data-type="'jsonp'"
                    :transport-create-url="'https://demos.telerik.com/kendo-ui/service/Products/Create'"
                    :transport-create-data-type="'jsonp'"
                    :transport-parameter-map="parameterMap"
                    :schema-model-id="'ProductID'"
                    :schema-model-fields="schemaModelFields"
                    :batch='true'
                    :page-size='20'>
</kendo-datasource>

<kendo-grid :height="600"
            :data-source-ref="'datasource1'"
            :pageable='true'
            :editable="'inline'"
            :toolbar="['create']">
    <kendo-grid-column field="ProductName"></kendo-grid-column>
    <kendo-grid-column field="UnitPrice" title="Unit Price" :width="120" :format="'{0:c}'"></kendo-grid-column>
    <kendo-grid-column field="UnitsInStock" title="Units In Stock" :width="120"></kendo-grid-column>
    <kendo-grid-column field="Discontinued" :width="120" :editor="customBoolEditor"></kendo-grid-column>
    <kendo-grid-column :command="['edit', 'destroy']" title="&nbsp;" width="170px"></kendo-grid-column>
</kendo-grid>

我在该代码中更改的是工具栏属性。

:toolbar="[
            {  text: 'Insert above', icon: 'insert-up', click: function(e){alert();}               },
            { text: 'Insert between', icon: 'insert-middle', onclick: createRecord },
            { text: 'Insert below', icon: 'insert-down', 'v-on:click': createRecord }]
            "

当然,这些选项都没有真正起作用。

有什么建议吗?

问候!

4

1 回答 1

2

最后我找到了一个方法...

我在这里发布解决方案...

  <kendo-grid :height="600"
            :data-source-ref="'datasource1'"
            :pageable='true'
            :sortable='true'
            :selectable="true"
            :editable="'inline'"
            >
    <kendo-grid-toolbar class="k-grid-toolbar">
      <button type="button" v-on:click="createRecord">abc</button>
    </kendo-grid-toolbar>
    <kendo-grid-column field="nu_interno_cbte"></kendo-grid-column>
    <kendo-grid-column field="de_comprobante"></kendo-grid-column>
    <kendo-grid-column field="fe_comprobante" :format="'{0:dd/MM/yyyy}'"></kendo-grid-column>
    <kendo-grid-column field="nm_cliente"></kendo-grid-column>
    <kendo-grid-column field="nm_imputacion"></kendo-grid-column>
    <kendo-grid-column field="im_total" title="Total" :width="120" :format="'{0:c}'"></kendo-grid-column>
    <kendo-grid-column :command="['edit', 'destroy']" title="&nbsp;"></kendo-grid-column>
</kendo-grid>

问候。

于 2018-01-27T19:03:52.923 回答