|
Requirements |
|
|
Telerik Product and Version |
2014.3.1411.440 |
|
Supported Browsers and Platforms |
GoogleChrome |
|
Components/Widgets used (JS frameworks, etc.) |
UIGrid |
PROJECT DESCRIPTION
[enter description here, together with step-by-step instructions on how to use the project]
We have several pages where we have noticed that the sorting of the grid is not working. We are attempting to sorty by four columns but to no luck we are able to get the desired results.. Attached is a sample of the binding as well as the controller method that retrieves the method.
I have tried binding it both in the controller using OrderBy, ThenBy extensions as well as the sort in the grid binding. Additionally I have also sorted the results within the method that the controller calls and have reviewed it with LinqPad and it appears to be sorting correctly. However I cannot get it bind sorted in the grid. Any help will be appreciated.
Grid Binding
Scrollable(a => a.Height("auto")) .Sortable() .PrefixUrlParameters(false) .Filterable() .Pageable(pageable => pageable .Refresh(true) .PageSizes(new[] { 50, 100, 250, 500, 1000 }) .Messages(messages => messages.ItemsPerPage(" items are currently displayed")) .ButtonCount(5)) .DataSource(dataSource => dataSource .Server().PageSize(250) .Sort(s => { s.Add(c => c.EAN).Ascending(); s.Add(c => c.IngramSku).Ascending(); s.Add(c => c.BusinessYear).Descending(); s.Add(c => c.BusinessMonth).Descending();
Controller Method Logic
var viewModel = new ViewModels.RAM.VendorQuarterlyRevenueViewModel() { VendorId = vendorId, VendorName = GetVendorName(vendorId), sort = sort, filter = filter, group = group, ShowDataGrid = true, ReportDate = new ViewModels.RAM.ReportDateViewModel() { BeginDate = beginDate, EndDate = endDate, MaxDate = maxDate, MinDate = minDate, }, VendorQuarterlyRevenueData = _ramReportRepository.GetVendorQuarterlyRevenue(_ramReportRepository.GetContext(), beginDate, endDate, vendorId) }; if (dataSourceRequest.Filters != null) { viewModel.VendorQuarterlyRevenueData = (IQueryable<VendorRevenueModel>)viewModel.VendorQuarterlyRevenueData.Where(dataSourceRequest.Filters); } foreach (var item in viewModel.VendorQuarterlyRevenueData) { viewModel.FreightRevenueSum += item.FreightRevenue; viewModel.NetSalesSum += item.NetSales; viewModel.RentalIncomeSum += item.RentalIncome; } return View("VendorQuarterlyRevenueReport", viewModel);
This is the situation:
I have a form that when i click in the submit button is sending a file
with the kendo upload control, and the method action of the controller
is receiving that file in the parameter with the HttpPostedFileBase.
This is my HTML code:
@using (Html.BeginForm("ConfirmarOposicion", "Gestion", FormMethod.Post, new { @id = "Frm-login", role = "form", @class = "form-horizontal" }))
{
@(Html.Kendo().Upload()
.Name("files")
)
<button class="btn btn-success" type="submit" id="confirm" >Confirm</button>
}
And this is my controller:
public async Task<ActionResult> ConfirmarOposicion(IEnumerable<HttpPostedFileBase> files)
{
// Here the parameter files is not null..
}
Here is working all good till now. The problem is when i try to send
more values as parameter into the same method of the controller.
The other values that i want to send is an array, and the other is a
number.
This two values i try to send with ajax in javaScript.
This is my javaScript code when i try to send those two more values:
$("#confirm").click(function ()
{
var numMarca = $("#numMarca").val()
var idsToSend = [];
var grid = $("#Grid2").data("kendoGrid")
var ds = grid.dataSource.view();
for (var i = 0; i < ds.length; i++)
{
var row = grid.table.find("tr[data-uid='" + ds[i].uid + "']");
var checkbox = $(row).find(".checkbox");
if (checkbox.is(":checked"))
{
idsToSend.push(ds[i].DescMarca);
idsToSend.push(ds[i].IntencionOposicion = 1);
}
else
{
idsToSend.push(ds[i].DescMarca);
}
}
$.ajax({
url: '@Url.Action("ConfirmarOposicion", "Gestion")',
data: { ids: idsToSend, marca: numMarca },
type: 'POST',
dataType: "json",
success: function (data)
{
...
}
When i clik the submit button is sending this two values in the same controller that i send the input file.
And this my controller now:
public async Task<ActionResult> ConfirmarOposicion(IEnumerable<HttpPostedFileBase> files, string[] ids, string marca)
{
// here the array ids and the value of marca is not null, but the parameter files it is null
}
And that's the issue that i have.
I need to send all those values in the same method action of the controller.
How can i do that?
This is a two part question, first how do I know what controller parameters are needed fro the update action for the tree view (Same question applies to all Kendo controls) No error is thrown so I don't known what route (route signature) to build.
Second, could be related to the first my action is public JsonResult Update([DataSourceRequest] DataSourceRequest request, ProductViewModel product) but when I do a drag and drop the action isn't fired. I have found when this happens typically it is because I don't have a matching signature for the route... but again no error is thrown so I can't debug it.
Thanks in advance and sorry if I am not using the correct terminology for this.

Hi,
it seems that the selection in the AutoComplete is not correct (see attached Pictures) - it should be the same as the other Dropdowns (Combo, list)
robert

I would like to refersh a layer in a kendo Map, there are 8 layers, but only want to refresh layer 1.
This would occur on a button click event.
my datasource for the layer is
.DataSource(source => source
.Custom()
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/EventInfo/_P4BubbleAreas/" + Model.showEventP4.ToString())
.DataType("json");
})
)
)
Hi,
I have a partial view that is referring to a model. I can open multiple models at the same time, which reflects in having that particular partial view shown multiple times.
The problem now is that every controlinside of it has an id (grids, multiselects ...), and by showing it multiple times I get into the situation that I have multiple controls with a same id.
Actually I can open it just 2 times, bcz then the controls get "broken" and dont load properly anymore (I need to refresh the page to get it working again).
Is there a way around that, best practice or smt ?
Regards
Hi,
i want to change the text color of a foreign key column depending on the values of two other columns.
I do this for a bounded column using a client template:
columns.Bound(p => p.CompanyAlternative).ClientTemplate("# if ( LeIdOriginal === LeIdAlternative) { # <div> #= CompanyAlternative # </div> # } else { # <div style='color: rgb(225,0,15);'> #= CompanyAlternative # </div> # } #");
But how can i achieve this for a foreign key?
Thanks
Michael
Hello,
I have a custom command column in my grid as seen below. I would like to change the text of the button from "Activate" to "Deactivate" based on 2 other cells values in the row. How can I do this? Thanks.
col.Command(command => command.Custom("Activate").Click("activate_deactivate")).Locked(true).Width(140);
Hi,
I have pretty complex appointment classes (with lots of dependencies). Now when I want to display them inside the scheduler I just read the most important information (start, end, title ...). But when I want to edit the appointment with my custom template, I want to load all the additional information (it would be too slow to load all that data for the scheduler).
So is there a possiblity to "reload" my object before showing it inside the template ?
Regards
Semir
I have a grid that I want to display inside a ClientTemplate, but the datasource is not binding
What am I missing to get the bind to occur.
Thanks
@(Html.Kendo().Grid<WebSite.Library.Models.SiteCriteria>()
.Name("siteCriteriaCriteria")
.Columns(columns =>
{
columns.Bound(p => p.siteId).Title("siteId").Width(50).Hidden();
//columns.Bound(p => p.premiseAreaId).Title("premiseId").Width(50).Hidden();
columns.Bound(p => p.areaId).Title("AreaId").Width(50).Hidden();
columns.Bound(p => p.name).Title("Hazard Area").Width(150);
columns.Template(p => "").Title("criteria").ClientTemplate(
Html.Kendo().Grid<WebSite.Library.Models.SiteCriteria>()
.Name("areaCriteria#=areaId#")
.Columns(c =>
{
c.Bound(e1 => e1.name).Title("Training").Width(100);
})
.AutoBind(true)
.DataSource(source1 => source1
.Custom()
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getTrainingAreas/_si=12117")
.DataType("json");
})
))
.ToClientTemplate()
.ToHtmlString()
);
})
//.Events(events => events.Remove("onRemove"))
.NoRecords("No criteria exists.")
.DataSource(source => source
.Custom()
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getPremiseArea/_si=" + Model.SiteId )
.DataType("json");
})
))
)