jQuery EasyUI Forum
June 19, 2013, 12:16:16 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
jQuery EasyUI Forum
>
General Category
>
Help for EasyUI
>
How to make a text field in datagrid 'required'?
Pages: [
1
]
« previous
next »
Print
Author
Topic: How to make a text field in datagrid 'required'? (Read 1750 times)
tomhj
Newbie
Posts: 20
How to make a text field in datagrid 'required'?
«
on:
July 19, 2012, 10:25:52 PM »
I have a treegrid with editable columns with types 'combobox', 'text', and 'checkbox'. The combobox and text fields are required. I can specify through the editor for the combobox and the options property that the field is required: true. But I don't see how to make the text field 'required'. The 'options' property seems to be ignored for that editor type.
Am I missing something?
Logged
stworthy
Administrator
Hero Member
Posts: 698
Re: How to make a text field in datagrid 'required'?
«
Reply #1 on:
July 19, 2012, 11:05:49 PM »
The 'text' editor is a simple textbox. To use additional editing options, please use the 'validatebox' editor:
Code:
columns:[[
{field:'name',title:'Name',width:120,
editor:{
type:'validatebox',
options:{
required:true
}
}
},
...
]]
Logged
tomhj
Newbie
Posts: 20
Re: How to make a text field in datagrid 'required'?
«
Reply #2 on:
July 19, 2012, 11:14:49 PM »
Thanks - that works. One odd thing though: when the row switches into edit mode, the combobox immediately shows the "this field is required" icon but the text/validatebox field doesn't show it until that field has the focus. Is that normal/expected behavior?
Logged
stworthy
Administrator
Hero Member
Posts: 698
Re: How to make a text field in datagrid 'required'?
«
Reply #3 on:
July 20, 2012, 01:29:04 AM »
When edit a row, all the empty field with 'required' property will display an alert icon on right of textbox. When move the mouse over the empty field with 'required' property, the 'this field is required' message will show immediately.
Logged
tomhj
Newbie
Posts: 20
Re: How to make a text field in datagrid 'required'?
«
Reply #4 on:
July 20, 2012, 08:23:46 AM »
That's what I was expecting, but it isn't what I'm seeing. The newly inserted row shows the red triangle icon in the required combobox field but not the validatebox field. The red triangle icon doesn't show in empty the validatebox field until I click in that edit box - then it stays there until I enter a value.
Here is the field definition for that column:
{field: 'name', title: 'Name', width:150, sortable:true, resizable:true, editor: { type: 'validatebox', options: {required: true}}}
Logged
tomhj
Newbie
Posts: 20
Re: How to make a text field in datagrid 'required'?
«
Reply #5 on:
July 20, 2012, 10:00:06 AM »
I figured out the problem - there was another column/field with a formatter that wasn't properly handling the field value being undefined.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> Help for EasyUI
=> Bug Report
Loading...