I want to put a splitter in a bootstrap collapse panel. This works fine when the collapse panel is loaded open (ie a class of collapse in). However when the page loads with the collapse is loaded closed, the splitter does not render. Is there a way to make this work short of having a document ready function that has $(".collapse").collapse('hide');?
Thank-you
Here is the cshtml code.
<div class="panel-heading" style="background-color: #717174;height: 35px;color:white;font-size:11px;width:100%;">
<div class="panel-title">
<div class="row">
<div class="col-md-6">
<form id="form1" name="form1">
<div class="input-group input-group-sm input">
<span style="color:white;font-size:12px;font-weight:bold;">Account: </span>
<input id="selacct" class="form-control" name="selacct" placeholder="Search Account #..." style="width:120px;font-size:10px;height:20px;vertical-align:middle;float:none">
<a href="#" style="color:white;height:20px;"><span class="glyphicon glyphicon-search"></span></a>
<div class="col-md-1" style="border-left:1px solid #cccccc;">
<a data-toggle="collapse" href="#collapse1" style="text-decoration:none;color:white;font-weight:bold;font-size:14px;"><span class="glyphicon glyphicon-menu-down"></span></a>
</div>
<!-- /.end see more -->
</div>
</div>
</div>
<div id="collapse1" class="panel-collapse collapse col-md-12">
<div class="panel-body" style="background-color: #999999;height: 250px;color:white;font-size:12px">
@(Html.Kendo().Splitter()
.Name("vertical")
.Orientation(SplitterOrientation.Vertical)
.Panes(verticalPanes =>
{
verticalPanes.Add()
.HtmlAttributes(new { id = "top-pane" })
.Scrollable(false)
.Collapsible(false)
.Content(
Html.Kendo().Splitter()
.Name("horizontal")
.HtmlAttributes(new { style = "height: 100%;" })
.Panes(horizontalPanes =>
{
horizontalPanes.Add()
.HtmlAttributes(new { id = "left-pane" })
.Size("220px")
.Content(@<div class="pane-content">
<h3>Inner splitter / left pane</h3>
<p>Resizable and collapsible.</p>
</div>);
horizontalPanes.Add()
.HtmlAttributes(new { id = "right-pane" })
.Size("220px")
.Content(@<div class="pane-content">
<h3>Inner splitter / right pane</h3>
<p>Resizable and collapsible.</p>
</div>);
}).ToHtmlString()
);
})
)
</div>
</div>
Hello,
for day I've been trying to get this to work, but with the current state of your documentation its impossible to find anything useful besides maybe Custom Server Binding which probably won't be helpful in my case anyways.
My problem is basically that grouping works, but it'll completely ignore any properties that are mapped from other models I included via Linq which, for whatever reason, works fine if I don't use grouping at all. I have a property in the ViewModel which displays the Count of the Jobs a Profile has (as seen in the code snipper further down) which will be completely ignored when I have grouping activated.
I do realize by the way that I could fix my problem by working with a list, but I want to keep using serverside paging and such for performance reasons.
return
_context.CrmProfiles.Where(p => ugIds.Contains(p.UserGroupId))
.Include(p => p.CrmType)
.Include(p => p.UserGroup)
.Include(p => p.OrdnungsbegriffType)
.Include(p => p.Jobs);
This is my Read-Action for filling the grid. I tried different ways to do this, but the result is always the same.
public
virtual
ActionResult Read([DataSourceRequest]DataSourceRequest request)
{
var samAccountName = Session[
"SamAccountName"
].ToString();
var result = _db.GetProfiles(samAccountName)
.ToDataSourceResult(request, j =>
new
{
CreatedAt = j.CreatedAt,
IsGlobalProfile = j.IsGlobalProfile,
CreatedBy = j.CreatedBy,
LastUpdatedBy = j.LastUpdatedAt,
LastUpdatedAt = j.LastUpdatedAt,
UserGroup = j.UserGroupName,
Name = j.Name,
JobCount = j.Jobs.Count
});
return
Json(result);
}
var result = _db.GetProfiles(samAccountName)
.ToDataSourceResult(request, Mapper.Map<CrmProfileGridVM>);
And this is my grid:
(Html.Kendo().Grid<CrmProfileGridVM>()
.Name(
"grid-crmprofiles"
)
.Columns(c =>
{
c.Bound(j => j.Name);
c.Bound(j => j.IsGlobalProfile).ClientTemplate(
"<input type='checkbox' disabled #=IsGlobalProfile ? checked='checked' : '' # />"
).Width(160).Sortable(
false
);
c.Bound(j => j.JobCount);
c.Bound(j => j.UserGroupName);
c.Bound(j => j.CreatedBy);
c.Bound(j => j.CreatedAt);
c.Bound(j => j.LastUpdatedBy);
c.Bound(j => j.LastUpdatedAt);
})
.ToolBar(toolBar => toolBar.Template(
"<a href='javascript: void(0)' class='button button-create2' title='Neues Profil anlegen' id='bt-profile-create'>button create</a>"
))
.HtmlAttributes(
new
{ style =
"height: 680px;"
})
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Events(e => {
e.DataBound(
"onProfileGridDataBound"
);})
.Scrollable()
.ClientDetailTemplateId(
"template-grid-crmprofile"
)
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(
true
)
.PageSizes(
true
)
.ButtonCount(5))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(
true
)
.Model(model => model.Id(p => p.Id))
.Read(r => r.Action(
"Read"
,
"CrmProfile"
))
.Events(e => e.Error(
"onProfileGridError"
))
.Group(g => g.Add(p => p.UserGroupName))
)
)
Could somebody please explain to me what the problem is? As far as I can tell AggregateFunctionsGroup is the reason why, but again .. no clue how to fix this.
Using the MVC menu I cant get rid of the text color style on hover. It seems something is firing on JQuery when the item is hovered. Its appending k-state-hover, which is setting the color property somewhere in the kendo style sheets.
I've tried to get rid of if using
#topmenu li .k-state-hover
{
color: #fdfdfd;
}​
or
#topmenu .k-state-hover
{
color: #fdfdfd;
}​​
I have a dynamic grid that I'm binding to the server. Since InCell editing is not available for with Server binding, I had to go to InLine with the Edit Button. When my grid renders I notice that no matter where I put the Edit Button, at the beginning or end of my list of columns, it's cut in half. I also noticed that there is no horizontal scrolling.
Here is my Razor view, attached is what I see after the grid renders. Has anyone seen this behavior before and how they fixed it?
@using SOCKETWorx.Site.Models
@model GridDynamicViewModel
@{
ViewBag.Title = Model.ModuleName;
Layout = "~/Views/Shared/_Layout.cshtml";
}
<
p
>
@Html.ValidationSummary(true, "", new { @class = "text-danger", id = "ValidationMessenger" })
</
p
>
<
p
>
@(Html.Kendo().DropDownList()
.Name("dropdownlist_GridViews")
.DataTextField("Value")
.DataValueField("Id")
.HtmlAttributes(new { style = "width:300px" })
.Events(e => e.Change("GridViews_OnChange"))
.Value(Convert.ToString(Model.ViewId))
.DataSource(source => source
.Custom()
.Group(g => g.Add("TypeName", typeof(string)))
.Transport(transport => transport
.Read(read =>
{
read.Action("GridView_Read", "Data").Data("OnAdditionalData");
}))
)
)
@(Html.Kendo().Button()
.Name("button_CreateView")
.HtmlAttributes(new { type = "button" })
.Content("Create New View")
.Events(ev => ev.Click("CreateView_onClick")))
@(Html.Kendo().Button()
.Name("button_EditView")
.HtmlAttributes(new { type = "button" })
.Content("Edit View")
.Events(ev => ev.Click("EditView_onClick")))
@(Html.Kendo().Button()
.Name("button_CloneView")
.HtmlAttributes(new { type = "button" })
.Content("Clone View")
.Events(ev => ev.Click("CloneView_onClick")))
<
span
id
=
"span_ToolTip"
style
=
"color: transparent"
>View</
span
>
<
hr
/>
@(Html.Kendo().Grid(Model.TheData)
.Name("grid_GridList")
.Columns(columns =>
{
columns.Command(command => { command.Edit(); });
if (Model.GridColumns != null)
{
columns.Bound(p => p.Id).Hidden();
foreach (ColumnSettings col in Model.GridColumns)
{
columns.Bound(col.PropertyName).Title(col.Title).Width(col.Width);
}
}
})
.ToolBar(toolbar =>
{
toolbar.Custom().Text("Export To Excel").Action("GenerateReport", "Chart", new { moduleId = Model.ModuleId, viewId = Model.ViewId });
toolbar.Custom().Text("Spreadsheet Mode").Action("Spreadsheet", "Data", new { moduleId = Model.ModuleId, viewId = Model.ViewId });
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.HtmlAttributes(new { style = "height:75vh" })
.Sortable()
.Scrollable()
.Resizable(r => r.Columns(true))
.Filterable()
.Groupable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(false)
.ButtonCount(5)
)
.Events(events =>
{
events.DataBound("OnDataBound");
events.Group("OnGroup");
})
.DataSource(dataSource => dataSource
.Server()
.PageSize((int)ViewBag.UserInfo.GridSize)
.Model(model =>
{
model.Id(p => p.Id);
if (Model.GridColumns != null)
{
foreach (ColumnSettings col in Model.GridColumns)
{
model.Field(col.PropertyName, col.ColType).Editable(col.Editable);
}
}
})
.Read(read => read.Action("List", "Data"))
.Update(update => update.Action("GridList_Update", "Data"))
)
)
</
p
>
@(Html.Kendo().Tooltip()
.For("#span_ToolTip")
.Content(Model.ToolTip)
.Position(TooltipPosition.Right)
.AutoHide(true)
.Width(650)
)
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
try {
var showGrid = "@Model.ShowGrid";
if (showGrid.toLowerCase() == "false") {
$("#grid_GridList").hide();
}
else {
$("#grid_GridList").show();
}
var canEdit = "@Model.CanEditView";
if (canEdit.toLowerCase() == "true") {
$("#button_EditView").show();
}
else {
$("#button_EditView").hide();
}
var toolTip = @Html.Raw(Json.Encode(Model.ToolTip));
if (toolTip != "") {
$("#span_ToolTip").show();
}
else {
$("#span_ToolTip").hide();
}
var showGridViewControls = "@ViewBag.ShowGridViewControls";
if (showGridViewControls.toLowerCase() == "false") {
$("#dropdownlist_GridViews").closest(".k-widget").hide();
$("#button_CreateView").hide();
$("#button_CloneView").hide();
}
}
catch(err) {
$("ValidationMessenger").text(err);
}
});
function GridViews_OnChange() {
var viewId = $("#dropdownlist_GridViews").val();
if (viewId == "0" || viewId == "") {
$("#grid_GridList").hide();
}
else {
$("#grid_GridList").show();
location.href = '@Url.Action("List", "Data")?moduleId=' + @Model.ModuleId + '&viewId=' + viewId;
}
}
function OnAdditionalData() {
var moduleId = "@Model.ModuleId";
var viewId = $("#dropdownlist_GridViews").val();
return {
moduleId,
viewId,
};
}
function OnDataBound(e) {
var isCadWorx = "@Model.IsCadWorx";
if (isCadWorx.toLocaleLowerCase() == "false") {
var that = this;
$(that.tbody).on("dblclick", "tr", function (e) {
var rowData = that.dataItem(this);
location.href = '@Url.Action("Detail", "Data", new {values = "val1" })'.replace("val1", rowData.Id);
});
}
}
function OnError(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
$("ValidationMessenger").text(message);
}
}
function OnGroup(arg) {
var groupByFields = [];
for (iCount = 0; iCount <
arg.groups.length
; iCount++) {
groupByFields[iCount] = arg.groups[iCount].field;
}
$.ajax({
type: "POST",
url: '@Url.Action("UpdateViewGroupedBy", "Data")',
contentType: "application/json;
charset
=
utf
-8",
data: JSON.stringify({ fields: groupByFields, viewId: @Model.ViewId }),
dataType: "json",
success: function (result) {
if (result.status != "Success") {
var msg = $("#ValidationMessenger");
if (msg) {
msg.text(result.message);
}
}
},
error: function () {
var msg = $("#ValidationMessenger");
if (msg) {
msg.text(result.message);
}
}
});
}
function CreateView_onClick() {
location.href
=
'@Url.Action("Index", "ViewManager")?gridviewaction=3&moduleId='
+ '@Model.ModuleId' + '&viewId=';
}
function EditView_onClick() {
var viewId = $("#dropdownlist_GridViews").val();
location.href
=
'@Url.Action("Index", "ViewManager")?gridviewaction=5&moduleId='
+ '@Model.ModuleId' + '&viewId=' + viewId;
}
function CloneView_onClick() {
var viewId = $("#dropdownlist_GridViews").val();
location.href
=
'@Url.Action("Index", "ViewManager")?gridviewaction=2&moduleId='
+ '@Model.ModuleId' + '&viewId=' + viewId;
}
</script>
I am seeking help to understand the documentation found here:
http://demos.telerik.com/aspnet-mvc/treelist/remote-data-binding
My questions are:
In the following snip it
public JsonResult Create([DataSourceRequest] DataSourceRequest request, EmployeeDirectoryModel employee)
{
if (ModelState.IsValid)
{
employeeDirectory.Insert(employee, ModelState);
}
return Json(new[] { employee }.ToTreeDataSourceResult(request, ModelState));
}
In this example the purpose is to create (insert) a new record. To do this this function calls the Insert method of the employeeDirectory method (which is presumable a method of the EmployeeDirectoryModel and it takes two parameters the employee (which was passed into this calling function, and the ModelState.
My question is, what does this Insert method do with the ModelState? It is passed in for a reason, so what is that reason?
The employee parameter will contain the data to be written to the database, except the primary key, does the Insert method load the primary key value into the model so that when it gets returned back (last line of snip it), there will be a fully loaded employee object?
When, where, how, does the ModelState get updated so that it knows that the employee object is full validated (i.e. has a primary key)?
Thank you
Hi,
I've been looking for a way to persist a grid's options, specifically page, page size, sort, filter, and group options, to the URL, in order to make shareable URLs that will set the grid data automatically.
I found this post and the referenced example, which I also found on Github, but unless I'm missing something big, this example simple serializes the options to the URL, but it never configures the grid with the options passed in the URL.
Still, inspired by this example, I experimented by manually parsing the URL. It took me a while to figure out that I have to allow a first binding before I can change settings such as page or page size, but I got that working. My problem now is the filter. A filter object is serialized into something like 'category~eq~somecat' and I can't figure out how to convert it back into an object that I can pass back to the query method. I guess I'll have similar problems with sorting and grouping.
Is there a built-in method to convert back the values serialized in the samples I mentioned? Or a sample that shows how to do this?
Thanks in advance,
Mauricio
<
table
>
<
tr
valign
=
"top"
>
<
td
style
=
"width:1%;"
>@Html.Label("RoleOperations", "Operations")</
td
>
<
td
>
@(Html.Kendo().MultiSelect()
.Name("AuthRoleOperationMultiselect_#=RoleID#")
.BindTo(ViewBag.AuthOperationListing)
.Placeholder("Select Operations...")
.DataTextField("Description")
.DataValueField("ID")
.Value("#=AuthOperationIDs#") //Type: List<
int
>
.ToClientTemplate()
)
</
td
>
</
tr
>
</
table
>
@(Html.Kendo().MultiSelect()
.Name("AuthRoleOperationMultiselect")
.Events(events =>
{
events.DataBound("ConfigureMultiselect");
})
.BindTo(ViewBag.AuthOperationListing)
.Placeholder("Select Operations...")
.DataTextField("Description")
.DataValueField("ID")
//Just selecting the info of the first item in the grid
.Value(Model.AdminModel.AuthorizationModel.AuthRoleOperationList[0].AuthOperationIDs) //Type: List<
int
>
)
<
div
id
=
"AuthRoleOperationContainer"
>
<
h3
style
=
"margin:1px;"
>Roles & Operations</
h3
>
@(Html.Kendo().Grid(Model.AdminModel.AuthorizationModel.AuthRoleOperationList)
.Name("AuthRoleOperationGrid")
.Columns(columns =>
{
columns.Bound(i => i.Description);
columns.Command(command =>
{
command.Destroy();
}).Width(100);
})
.ClientDetailTemplateId("AuthRoleOperationDetails")
.ToolBar(toolbar =>
{
toolbar.Template(@<
text
>
<
a
class
=
"k-button k-button-icontext k-grid-add"
href
=
"#_"
>
<
span
class
=
"k-icon k-add"
></
span
>Add new item
</
a
>
<
a
class
=
"k-button k-button-context"
onclick
=
"SaveAuthRoleOperations();"
href
=
"#"
>
<
span
class
=
"k-icon k-add"
></
span
>Save changes
</
a
>
<
a
class
=
"k-button k-button-icontext k-grid-cancel-changes"
href
=
"#"
>
<
span
class
=
"k-icon k-cancel"
></
span
>Cancel changes
</
a
>
</
text
>);
})
.Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
.Navigatable(navigatable => navigatable.Enabled(true))
.Pageable()
.Sortable()
.Filterable()
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Sort(sort => sort.Add("Description").Ascending())
.Model(model =>
{
model.Id(i => i.RoleID);
})
.Read(read => read.Action("GetAuthRoleOperations", "Authorization"))
.Create(create => create.Action("CreateAuthRoleOperations", "Authorization"))
.Update(update => update.Action("UpdateAuthRoleOperations", "Authorization"))
.Destroy(destroy => destroy.Action("DeleteAuthRoleOperations", "Authorization"))
)
)
</
div
>
<
script
id
=
"AuthRoleOperationDetails"
type
=
"text/kendo-tmpl"
>
@Html.Partial("DetailTemplates/AuthRoleOperationDetails")
</
script
>
Hi,
I have a treelist where I want to show a tooltip when you hover over a certain span tag inside one of the columns. The span is added to the column via the .templateId - function.
Here is the Code for what I'm trying to do. The problem is I don't get the (Html.Kendo().Tooltip() function to bind the tooltip functionality to the span when the span is generated via the templateId function. If I just make a span anywhere else outside the treelist it works fine. The spans all have their own id : "tooltip_0" etc. How would I go about implementing this?
@model TemplatesViewModel
@{
ViewBag.Title = "Create Item Req";
}
<
script
type
=
"text/x-kendo-tmpl"
id
=
"popupTemplate"
>
<
div
class
=
"pop-product-view"
>
<
dl
>
<
dt
>Item Number</
dt
>
<
dd
> #:ItemNbr#</
dd
>
<
dt
>Description</
dt
>
<
dd
>#:Descr#</
dd
>
<
dt
>Quantity</
dt
>
<
dd
>#:Qty#</
dd
>
</
dl
>
<
div
class
=
"pop-edit-buttons"
>
<
a
class
=
"k-button k-edit-button"
href
=
"\\#"
><
span
class
=
"k-icon k-i-edit"
></
span
></
a
>
<
a
class
=
"k-button k-delete-button"
href
=
"\\#"
><
span
class
=
"k-icon k-i-delete"
></
span
></
a
>
</
div
>
</
div
>
</
script
>
<
div
class
=
"modal-body"
>
@using (Ajax.BeginForm("TestAjaxForm", "WFAction", FormMethod.Post,
new AjaxOptions
{
HttpMethod = "POST",
OnBegin = "onBegin",
OnSuccess = "onSuccess",
OnFailure = "onFailure",
})
)
{
@(Html.EditorForField(m => m.Descr))
@(Html.EditorForField(m => m.VendorID))
<
br
/>
<
a
class
=
"k-button k-button-icontext k-add-button"
href
=
"#"
><
span
class
=
"k-icon k-i-add"
></
span
>Add Item</
a
>
@(Html.Kendo().ListView<
ItemsViewModel
>()
.Name("listView")
.TagName("div")
.BindTo(Model.Items)
.ClientTemplateId("popupTemplate")
.DataSource(dataSource => dataSource
.Model(m => {
m.Id(f => f.ItemNbr);
m.Field(f => f.Descr);
m.Field(f => f.Qty);
})
.PageSize(4)
.Create(create => create.Action("Editing_Create", "WFAction"))
.Read(read => read.Action("Editing_Read", "WFAction"))
.Update(update => update.Action("Editing_Update", "WFAction"))
.Destroy(destroy => destroy.Action("Editing_Destroy", "WFAction"))
)
.Pageable()
.Editable(e => e.Enabled(true).TemplateName("ListViewKendoEditTemplate"))
)
<
button
id
=
"save"
type
=
"submit"
>Save</
button
>
@*@(Html.Kendo().Button().Name("submitFormButton").Content("Save").Events(e => e.Click("onSubmitFormClick")))*@
}
</
div
>
// The editor template
@model ItemsViewModel
<
div
class
=
"pop-product-view"
>
<
dl
>
<
dt
>Item</
dt
>
<
dd
>
<
input
name
=
"ItemNbr"
data-source
=
"items"
data-role
=
"dropdownlist"
data-text-field
=
"Descr"
data-value-field
=
"ItemNbr"
/>
</
dd
>
@*<
dt
>Description</
dt
>
<
dd
>#:Descr#</
dd
>*@
<
dt
>Quantity</
dt
>
<
dd
>
@(Html.EditorForField(m => m.Qty)) @*<
input
type
=
"text"
class
=
"k-text"
data-bind
=
"value:Qty"
name
=
"#:Qty#"
/>*@
</
dd
>
</
dl
>
<
div
class
=
"pop-edit-buttons"
>
<
a
class
=
"k-button k-button-icontext k-update-button"
href
=
"\\#"
>Save Item</
a
>
<
a
class
=
"k-button k-button-icontext k-cancel-button"
href
=
"\\#"
>Cancel</
a
>
</
div
>
</
div
>
The editor template works and it writes the data back into the display template but I want the data in the ListView to bind to the TemplatesViewModel's property Items which is an IEnumerable of ItemsViewModel. When I get the data back in the controller it isn't binding to the Model but the other fields are binding fine for the Descr and VendorID.