EasyUI Forum

General Category => EasyUI for Vue => Topic started by: fengdie on December 02, 2018, 09:12:51 AM



Title: datagrid component edit mode how to add fields validate
Post by: fengdie on December 02, 2018, 09:12:51 AM
this is easyui for jquery code.
Code:
columns      : [[
            {
                field:'title',title:'回访计划名称',width:430,halign:'center',
                editor : {
                    type : 'textbox',
                    options : {
                        required : true
                    }
                }
            },
]]


Title: Re: datagrid component edit mode how to add fields validate
Post by: jarry on December 02, 2018, 05:23:05 PM
Wrap the DataGrid with a Form and add validating rules to the Form. Please look at this code:
Code:
<Form :model="editRow" :rules="rules" @validate="errors=$event">
<DataGrid ref="dg" style="height:250px"
:data="data"
:clickToEdit="true"
editMode="row"
@editBegin="editRow=$event.row"
>
<GridColumn field="itemid" title="Item ID" :editable="true"></GridColumn>
<GridColumn field="name" title="Name" :editable="true">
<template slot="edit" slot-scope="scope">
<TextBox v-model="editRow.name" name="name" v-Tooltip="getTipOpts('name')"></TextBox>
</template>
</GridColumn>