I show you the scenario, we have a combobox with filter “contains”.
Combobox ProductorSearch
Model
Grid in View
The first time I write a text with 4 o more chars my chars are hidden and then I can see a char 0. This behavior is only occurred the first time, after that the behavior is normal.
Thanks in advance.
Xavier
Combobox ProductorSearch
@model
int
@(Html.Kendo().ComboBox()
.Name(
"ContactID"
)
.HtmlAttributes(
new
{ style =
"width:300px"
})
.AutoBind(
false
)
.Placeholder(
"Escriu..."
)
.DataTextField(
"Nom"
)
.DataValueField(
"ContactID"
)
.Filter(FilterType.Contains)
.MinLength(4)
.DataSource(source =>
{
source.Read(read => read.Action(
"SearchProductors"
,
"Productors"
,
new
{ area =
"Comercial"
}).Data(
"filterProductors"
))
.ServerFiltering(
true
);
})
//.HeaderTemplateId("ProductorSearch_HeaderTemplate")
.TemplateId(
"ProductorSearch_ItemTemplate"
)
)
<script id=
"ProductorSearch_HeaderTemplate"
type=
"text/x-kendo-tmpl"
>
<div>
<span
class
=
"k-widget k-header"
>Productor</span>
<span
class
=
"k-widget k-header"
>Poblacio</span>
</div>
</script>
<script id=
"ProductorSearch_ItemTemplate"
type=
"text/x-kendo-tmpl"
>
<div style=
"width:300px"
>
@*<span
class
=
"k-state-default"
>#: data.Poblacio #</span>*@
<p><span
class
=
"k-state-default"
>#: data.Nom #</span><span
class
=
"k-state-default"
>#: data.Poblacio #</span></p>
</div>
</script>
Model
public
class
CollectServiceViewModel
{
[DisplayName(
"Ordre"
)]
[HiddenInput(DisplayValue =
false
)]
[Required(ErrorMessage =
"El número d'ordre es obligatori."
)]
public
int
ServiceID {
get
;
set
; }
[DisplayName(
"Albarà"
)]
public
string
RefExt {
get
;
set
; }
[DisplayName(
"Full Seguiment"
)]
public
string
DocNum {
get
;
set
; }
[DisplayName(
"Data Comanda"
)]
//[DisplayFormat(DataFormatString = "{0:d}")]
[DataType(DataType.Date)]
public
DateTime DataOrdre {
get
;
set
; }
[DisplayName(
"Data Servei"
)]
[DataType(DataType.Date)]
[UIHint(
"CustomDate"
)]
public
Nullable<DateTime> DataServei {
get
;
set
; }
[DisplayName(
"Expedició"
)]
[UIHint(
"ExpeditionsByData"
)]
public
Nullable<
int
> ExpeditionID {
get
;
set
; }
//public Nullable<short> Position { get; set; }
[DisplayName(
"Urgent"
)]
public
bool
Urgent {
get
;
set
; }
[DisplayName(
"Reclamat"
)]
[DataType(DataType.Date)]
public
Nullable<DateTime> DataClaim {
get
;
set
; }
[DisplayName(
"Recollida Extra"
)]
public
bool
Extra {
get
;
set
; }
[DisplayName(
"Productor"
)]
[Required(ErrorMessage =
"El productor es obligatori."
)]
[UIHint(
"ProductorSearch"
)]
public
int
ContactID {
get
;
set
; }
[DisplayName(
"Productor"
)]
[HiddenInput(DisplayValue =
false
)]
public
string
ProductorName {
get
;
set
; }
Grid in View
@(Html.Kendo().Grid<CollectServiceViewModel>()
.Name(
"collects"
)
.HtmlAttributes(
new
{ style =
"height: 100%; border: 0;"
})
.Scrollable()
.ToolBar(t =>
{
if
(User.IsInRole(
"Modify"
))
{
t.Create().Text(
"Nou Servei"
);
}
})
.Columns(columns =>
{
columns.Bound(f => f.ServiceID).Width(80);
columns.Bound(f => f.DataServei).Width(110);
columns.Bound(f => f.RefExt).Width(110);
columns.Bound(f => f.DocNum).Width(110);
columns.Bound(f => f.ProductorName).Width(300).Filterable(f => f.Operators(g => g.ForString(h => { h.Clear(); h.Contains(
"Conté"
); })));
columns.Bound(f => f.ContactID).Title(
"Codi"
).Width(80);
The first time I write a text with 4 o more chars my chars are hidden and then I can see a char 0. This behavior is only occurred the first time, after that the behavior is normal.
Thanks in advance.
Xavier