Telerik Forums
UI for ASP.NET MVC Forum
1 answer
105 views

Hi friends, I have got 4 records in the first filter (multi check boxes) attempt, now I want to filter in those 4 records for the second time.How to get this?Please help.

My code-

  @(Html.Kendo().Grid(Model).Name("grid").Columns(column =>
                                                  {                                                     
                                                      column.Bound(x => x.ProductID).Filterable(ftb => ftb.Multi(true).Search(true));
                                                      column.Bound(x => x.RackID).Filterable(ftb => ftb.Multi(true).Search(true));                                         
                                                      column.Bound(x => x.ProductName).Filterable(ftb => ftb.Multi(true).Search(true));
                                                      column.Bound(x => x.Price).Filterable(ftb => ftb.Multi(true).Search(true));
                                                  })
                     .Pageable().Sortable().Filterable().Resizable(resize => resize.Columns(true))
                     .DataSource(dataSource => dataSource.Ajax().ServerOperation(false).Model(model => model.Id(p => p.ProductID))
                     )                   
                    )

Viktor Tachev
Telerik team
 answered on 02 Mar 2018
1 answer
252 views

I have a child-grid where I want to to subtract the 'Value' column-cell with the previous 'Value' column-cell client-side, I tried using a ClientTemplate but I couldn't get it to work .

Ex, Let's say I am looking at the 'Value' with the 'SensorId' 3, I want the 'Change' column to be: 'Value' where 'SensorId' == 3 - 'Value' where 'SensorId' == 4, and so forth.

Thanks in advance.

@(
Html.Kendo().Grid<ErvinBeta.Models.ViewModels.ValueViewModel>().Name("ValueGrid#=SensorId#")
    .DataSource(ds => ds.Ajax()
    .Model(m => m.Id(sv => sv.SensorId))
    .PageSize(15)
    .Read(read => read.Action("ReadValue", "Home", new { SensorId = "#=SensorId#" }))
    .Sort(sort => sort.Add(sv => sv.Timestamp).Descending()))
 
    .Columns(columns =>
    {
        columns.Bound(sensorValue => sensorValue.ValueId).Visible(false);
        columns.Bound(sensorValue => sensorValue.SensorId).Visible(false);
        columns.Bound(sensorValue => sensorValue.Value).Title("Value")
             .HtmlAttributes(new { @class = "valueColumn" }).Width(150)
             .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))
             .Cell(cell => cell.ShowOperators(false)));
        columns.Bound(sensorValue => sensorValue.Category.Unit)
             .Title("Unit").Width(200).Filterable(false);
        columns.Bound(sensorValue => sensorValue.Timestamp).Title("Timestamp")
             .Format("{0:yyyy-MM-dd}").Filterable(ftb => ftb.Cell
             (cell => cell.Operator("contains")).Cell(cell => cell.ShowOperators(false)));
    })
    .Scrollable()
    .Pageable()
    .Sortable()
    .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
    .HtmlAttributes(new { style = "height: 600px;", @class="valueTable"})
    .ToClientTemplate()
)

Viktor Tachev
Telerik team
 answered on 02 Mar 2018
2 answers
3.0K+ views

I am new to Telerik and pretty new to Javascript or css as well. Wanting to build a website that uses the Kendo.Menu() it can be responsive. and want to achive like as
Menu dropdown view on this template  https://adminlte.io/themes/AdminLTE/pages/UI/general.html
I thought I would find a sample app that does part of what I need to do, like dropdown menu expand, left side menu lexpandable. It doesn't look like any of the sample apps do this sort of thing.  or if anyone achive to create sample dropdown menu and LeftSide collapse /expand navigation menu from this template

https://demos.telerik.com/kendo-ui/html5-dashboard-sample-app/ , please share to me.

Does anyone know of a sample application that I could use to learn Telerik and help with my application that I would like to create? If it used the Kendo.Menu() as the base, that would be fantastic.

Thanks in advance

Ivan Danchev
Telerik team
 answered on 01 Mar 2018
8 answers
1.0K+ views

So I have this model with these 2 property

 

public DateTime DateTimeChangeDate //  a date time object, with a UTC value, so kendo grid will provides me a date picker for filtering

and 

public string ChangeDate //is an UTC date in iso 8601 format that I pass to moment.js in my view to format the date

 

So in my view it works fine. I have the column defined as like this

  columns.Bound(m => m.DateTimeChangeDate)<br>                    .Title("Date and Time")<br>                    .ClientTemplate("#= formatUtcDateToLocal(ChangeDate)#")<br>                    .Width("12%");

and I am listening to the excel export as well

  .ExcelExport("modifyFormatForExcel")

where modify excel is defined like this

I also have looked at how to use template as mentioned here, but becuase all my template does is call a js function it did not make sense for me to write code to grab the template to only run the js function.

modifyFormatForExcel = function (e) {
        var sheet = e.workbook.sheets[0];
        for (var i = 0; i < sheet.columns.length; i++) {
            if (i === 0) {
                sheet.columns[i].width = 200;
            } else {
                sheet.columns[i].autoWidth = true;
            }
        }
 
        try {
            // By grouping we shift the column to the right so we need to keep track of how many time it has been shifted
            // in order to find out when the cells with actual data will start
            var dataColumnStart = sheet.filter.from;
            for (var j = 0; j < sheet.rows.length; j++) {
                var row = sheet.rows[j];
                //only apply formatting to excel rows that contains data
                if (row.type === "data") {
                    console.log(dataColumnStart);
                    console.log(e.data);
                    row.cells[dataColumnStart].value = formatUtcDateToLocal(HOW DO I GET CHANGE DATE HERE);
                }
            }
        } catch (exception) {
            logJavascriptError(exception.message, exception.fileName, exception.lineNumber, exception.columnNumber, exception.stack);
           notification.error("An error occurred while exporting to excel", true);
        }
    };

I also looked at using e.data but the array becomes nested as I group and sort the grid before I export to excel. 

Is there a simple way for me to gracmodifyFormatForExcel 

 

Konstantin Dikov
Telerik team
 answered on 28 Feb 2018
9 answers
722 views

I'm absolutely stuck trying to create a server side aggregate.  I can't find any examples or documentation that describes how to do this.

I've seen posts that recommend using AggregateFunction but I think that may be for Telerik grids or changed.  I've tried using an AggregateResult but that won't let me set the member.  

Any help or working examples would be very much appreciated.

 

 

Konstantin Dikov
Telerik team
 answered on 28 Feb 2018
1 answer
266 views

HI how to hide the filter button in the filter dropdown for only a single column.

 

 

Georgi
Telerik team
 answered on 27 Feb 2018
1 answer
454 views

In demo:

https://demos.telerik.com/aspnet-mvc/grid/editing-custom

we can see column with datatype CategoryViewModel.

Can we make a filter like demo in link below with that?

https://demos.telerik.com/aspnet-mvc/grid/filter-menu-customization

 

Thanks

 

Georgi
Telerik team
 answered on 27 Feb 2018
7 answers
438 views
When I filter a text column in the MVC grid, the sql that gets sent to SQL server is using the "lower" function to perform case-insensitive search. However, SQL Server already does case insensitive comparisons and the call to lower prevents from the index on that column to be used.

Example of SQL being sent to SQL Server:

SELECT [Extent1].[ID] AS [ID], [Extent1].[Capture Date] AS [Capture Date], [Extent1].[Item Sequence Number] AS [Item Sequence Number], 
        FROM [dbo].[Images] AS [Extent1]
        WHERE ((LOWER([Extent1].[Account Number])) = (LOWER('112233'))) OR ((LOWER([Extent1].[Account Number]) IS NULL) AND (LOWER('112233') IS NULL))

I am using hte latest version of Telerik UI for MVC and EF 6. The datasource code in the controller is:

public ActionResult Images_Read([DataSourceRequest]DataSourceRequest request)
{
    return this.Json(this._repository.Images.ToDataSourceResult(request));
}

Can I prevent Telerik's grid from using t-sql's lower function?
Tsvetina
Telerik team
 answered on 27 Feb 2018
6 answers
747 views
It would be nice if we had some more real business sample apps.  I see there are a few examples on git hub but are quite limited.  There is a mention of a Northwind Sample coming which would be more useful.    Something with a fair few linking tables,  some lookup lists, CRUD forms.   There are of course different samples online here but not too many actual complete MVC examples.  Most examples have blank MVC controllers!!.  So im not sure about anyone else but I have to then try to implement these examples using MVC with entity framework sending data to the view and back to the controller.  This usually involves a lot of head scratching and trail and error before i manage success.   

If i click on http://www.telerik.com/aspnet-mvc then click on Demos it takes me to the Kendo demos which has examples for ASP.net and MVC with razor syntax etc, but when i click on documentation all this has gone and all the documentation is in the plain html syntax with no mention of MVC.  

The Sample Kendo apps apps websushi, aeroviewr are nice and pretty.  The ASP.NET sample salesdashboard is basiclly lets see how many pretty visual elements we shove into one page.  The WPF Sample apps are the same.   But your tools are used for more than just pretty websites and sales dashboards with loads of graphs and charts.   They are also used for boring financial applications with lots of basic but very different types of data entry forms.  The meat and potatoes of business applications.  Show us how to build these apps too.  The bootstrap example page would be quite useful if you turned it into an MVC sample application with full CRUD forms etc.   Nothing too complicated just something like using he Northwind or Adventure Work databases (or one of your own).   This would i'm sure save people a  lot of time.

Thanks


Misho
Telerik team
 answered on 27 Feb 2018
1 answer
172 views

Trying to accomplish a simple task, after loading I want to set the map extent based on the marker layer.

I have the code to create the extent and set it but timing is the issue. When I try to do this on document ready the layer item list is empty and there is no explicit "load" event I can attach a handler to. Firing on "reset" will cause infinite recursion since the function is itself changing the viewport of the map plus it seems to fire multiple times.

Basically, I just need to know when this should be called and how to wire a handler to do it at that time.

var map = $('#map').getKendoMap();
var layer = map.layers[1];
var markers = layer.items;
var extent;
 
for (var i = 0; i < markers.length; i++) {
  var loc = markers[i].location();
  if (!extent) {
    extent = new kendo.dataviz.map.Extent(loc, loc);
  } else {
    extent.include(loc);
  }
}
 
map.extent(extent);

.

 

Preslav
Telerik team
 answered on 26 Feb 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?