I am able to get data from the source.Read method as pictured. However, the control doesn't display back the data.
Once I get that working, I need to post changes to the item order. If I have:
Then I move c up one:
How do I capture the position of c and the position of b to update the database using the Order property? I assume I capture the onReorder event.
public partial class Option
{
public int Id { get; set; }
[MaxLength(50)]
public string Name { get; set; }
[MaxLength(128)]
public string Description { get; set; }
public int Order { get; set; }
...
@(Html.Kendo().ListBox()
.DataTextField("Name")
.DataValueField("Id")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("IndexJson", "SessionOptionTemplates").Data("gridGetData");
});
})
.Toolbar(toolbar =>
{
toolbar.Position(ListBoxToolbarPosition.Right);
toolbar.Tools(tools => tools
.MoveUp()
.MoveDown()
.Remove());
})
.Events(events => events
.Remove("onRemove")
.Reorder("onReorder")
))
Thanks in advance for your help, Joel
I use a Grid to display back some rows that have an Order{int} field. When I display these items in the grid and elsewhere, they are to be displayed by order.
I would like the user experience to have the 1st column in the grid contain up and down arrows. Then, the user can select up/down on the arrows and the grid will submit a change to the row and the grid will display the row in its new location.
This is similar to how your NumericTextBox (https://demos.telerik.com/aspnet-core/numerictextbox/index) has arrows except this just sets the order in which the records display in the grid.
public partial class Option
{
public int Id { get; set; }
[MaxLength(50)]
public string Name { get; set; }
[MaxLength(128)]
public string Description { get; set; }
public int Order { get; set; }
}
I'm using UI for ASP.NET core 2020.3.1118, and i'm trying to implement a child grid with the ability to add an entry to my child grid
I need to pass the Id value from my Parent Grid to the model of the child when i add a new entry
I've been trying to use the
model.Field(gp => gp.GroupId).DefaultValue(0);
using a kendo template value "#=id#" in the child grid definition, without success as the DefaultValue method only seems to allow to accept actual values.
I'm really looking for advice here,
i've currently resolved the issue by passing an additional parameter in my Create action and updating the model in my controler with the parameter
.Create(create => create.Action(
"Post"
,
"GroupsPermission"
,
new
{ NewGroupId =
"#=Id#"
}))
Thanks in Advance
I have a grid that is loading in a modal popup (a partial view) that requires some information from the parent page being set before calling the datasource on the controller. I have set AutoBind to false and while it does prevent the datasource from calling the controller until I load the partial view, the .Data(javascript function) that builds the dataset needed for the controller is still being hit as soon as the parent page is initialized, but before the values on the page have been set (user input fields).
Is there a way to either prevent this from happening, or is there another technique I should be using?
Thanks for any help in advance
Hi
I have implemented the card UI and have the drag and drop working using the example script
$(document).ready( function () { $("#list").kendoSortable({ filter: ".k-card", cursor: "move", placeholder: function (element) {return element.clone().css("opacity", 0.1);}, hint: function (element) {return element.clone().css("width", element.width()).removeClass("k-state-selected");}});});
I want to be able to save the new order if the user drags and drops and item.
Is there an event to know when a drag and drop action has occurred.
Then I can loop through a class in javascript and grab the order from the ids or a data attribute to re-order the items.
Many thanks