or
...ClientTemplate(@Html.ActionLink("#=Company.Name#", MVC.Company.ActionNames.Index, MVC.Company.Name, new { id = "#=Company.Id#" }).ToHtmlString());
@(Html.Kendo().DropDownListFor(m => m)
.Name("SalesRep")
.DataSource(
config => config.Read(read => read.Action("SalesRepRead", "TemplateData", new { area = "" }).Data("filterGrid")))
.DataValueField("Value")
.DataTextField("Text")
)
<
input
data-bind
=
"value: value"
data-role
=
"autocomplete"
data-text-field
=
"Name"
data-filter
=
"startswith"
data-delay
=
"100"
data-min-length
=
"1"
data-value-primitive
=
"true"
type
=
"text"
class
=
"k-input"
autocomplete
=
"off"
role
=
"textbox"
aria-haspopup
=
"true"
aria-disabled
=
"false"
aria-readonly
=
"false"
aria-autocomplete
=
"list"
aria-owns
=
""
style
=
"width: 100%;"
aria-busy
=
"false"
><
br
>
@helper RenderProductsSearch()
{
@(Html.Kendo().Grid<
ViewableSelectableProduct
>()
.Name("grid-products-search-#=ID#")
.AutoBind(true)
.Pageable(pager => pager
.Input(true)
.Numeric(true)
.Info(true)
.PreviousNext(true)
.Refresh(true)
.PageSizes(true)
)
.Scrollable()
.Sortable()
.Navigatable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.HtmlAttributes(new { style = "height: 100%; border: 0;" })
.Columns(columns =>
{
columns.Bound(e => e.Name).Width(300).Title("name").Filterable(f => f.Cell(cell => cell.Operator("contains").ShowOperators(false).Delay(100)));
columns.Bound(e => e.Sku).Width(200).Title("sku").Filterable(f => f.Cell(cell => cell.Operator("contains").ShowOperators(false).Delay(100)));
columns.Bound(e => e.ShortDescription).Title("description").Filterable(f => f.Cell(cell => cell.Operator("contains").ShowOperators(false).Delay(100)));
columns.Command(command => command.Custom("Select").Click("selectProduct"))
.Title("commands")
.Width(Constants.Columns.Default.Widths.ColumnCommands);
})
.Filterable(filterable => filterable
.Extra(false)
.Operators(ops => ops
.ForString(str => str.Clear()
.Contains("Contains")
)))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.Id);
model.Field(x => x.Id).Editable(false);
model.Field(x => x.Name).Editable(false);
model.Field(x => x.Sku).Editable(false);
model.Field(x => x.ShortDescription).Editable(false);
})
.PageSize(5)
.Events(events =>
{
events.Error("standard_grid_error_handler");
})
//.Batch(true)
.ServerOperation(true)
.Read(read => read.Action("ReadSelectable", "Product", new { blockId = "#=ID#" }))
)
.ToClientTemplate()
)
}
Hi there,
I've created a grid which bounds on a "Special" object, which has "real" properties and a list of variable properties.
This is the (single) object:
public class DynPartView
{
Guid _Id;
public Guid Id
{
get { return _Id; }
set { _Id = value; }
}
List<
Prop
> _Properties;
public List<
Prop
> Properties
{
get { return _Properties; }
set { _Properties = value; }
}
...snip...
string _Standard;
public string Standard
{
get { return _Standard; }
set { _Standard = value; }
}
string _SelectedMKL;
public string SelectedMKL
{
get { return _SelectedMKL; }
set { _SelectedMKL = value; }
}
string _SelectedManufacturer;
public string SelectedManufacturer
{
get { return _SelectedManufacturer; }
set { _SelectedManufacturer = value; }
}
}
@(Html.Kendo().Grid(Model)
.Name("partgrid")
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Model(m =>
{
int y;
m.Id(d=>d.Id);
m.Field(f => f.SelectedMKL);
m.Field(f => f.SelectedManufacturer);
m.Field(f => f.Standard).Editable(false);
for (y = 0; y <= Model.PropertiesCount; y++)
m.Field(f => f.Properties[y].Value);
})
.Read(read => read.Action("Read_DynParts", "Parts", new { typeID = _typeid, mklName = _name }))
.Create(create => create.Action("EditingInline_Create", "Parts"))
.Update(update => update.Action("EditingInline_Update", "Parts"))
)
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Custom().Text("Kopieren");
toolbar.Save();
})
.Columns(columns =>
{
int j = 0;
columns.Bound(b => b.Id).Hidden();
columns.Bound(b => b.SelectedMKL).Title("MKL");
columns.Bound(b => b.Standard).Title("Norm");
columns.Bound(b => b.SelectedManufacturer).Title("Hersteller");
for (j = 0; j <
Model.PropertiesCount
; j++)
{
string
_title
=
""
;
if (Model.Count() >= 1)
_title = Model[0].Properties[j].Name;
columns.Bound(b => b.Properties[j].Value).Title(_title);
}
})
.Resizable(r => r.Columns(true))
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
.Pageable(page => page.Enabled(true).PageSizes(new int[] { 10, 30, 50, 100, 1000 }))
.Sortable()
.Selectable(sel => sel.Mode(GridSelectionMode.Single))
.Reorderable(r => r.Columns(true))
)
@(Html.Kendo().Tooltip()
.For("#Grid")
.Filter("td.contains-data")
.ContentTemplateId("template")
.Width(400)
.Height(200)
.AutoHide(false)
.ShowOn(TooltipShowOnEvent.Click)