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

Hi,

I have the following grid...

$("#grid").kendoGrid({
            toolbar: ["excel"],
            excelExport: function (e) {
                e.workbook.fileName = "Test.xlsx";
                e.workbook.sheets[0].title = 'Hello World';
              
                var rows = e.workbook.sheets[0].rows;
                e.workbook.sheets[0].rows.unshift({
                    cells: [
                      {
                          value: ''
                      }
                    ],
                });
                e.workbook.sheets[0].rows.unshift({
                    cells: [
                      {
                          value: 'Football: ' + $('input[name=mnuFoot]:checked').val(),
                          bold: true
                      }
                    ],
                });
                e.workbook.sheets[0].rows.unshift({
                    cells: [
                      {
                          value: 'Soccer: ' + $('input[name=mnuSoccer]:checked').val(),
                          bold:  true
                      }
                    ],
    
                });
 
                for (var ri = 0; ri < rows.length; ri++) {
                    var row = rows[ri];

                    if (row.type == "group-footer" || row.type == "footer") {
                        for (var ci = 0; ci < row.cells.length; ci++) {
                            var cell = row.cells[ci];
                            if (cell.value) {
                                 //Use jQuery.fn.text to remove the HTML and get only the text
                                cell.value = $(cell.value).text();
                                //Set the alignment
                                cell.hAlign = "right";
                            }
                        }
                    }
                }
            },

......

How can I export the data using the same functionality as the button on the toolbar using a button outside of the grid?

 

Thanks,

Liem

 

Liem
Top achievements
Rank 1
 answered on 01 Aug 2017
1 answer
547 views

HI All,

        Is it possible to convert kendo UI filter textbox to dropdown and bind custom data? I need answer in server side grid. pls see attachment

Georgi
Telerik team
 answered on 31 Jul 2017
1 answer
481 views

I have a Kendo MVC Grid that has a column with a DateTime column.    Everything looks good and formats correctly.   When i filter,  it gives me a date picker and a time picker.  When i remove the DateTimeFilter Template below and use template contains,  it will give me a Date picker (which i want),  but still wants to filter by the date and time..     Is there a way i can have the date and time all as the same field,  but only filter with a Date picker.?     Example:  i use the Date picker to pick 07/24/2017 and it filter everything on that date regardless of time..      Or do they need to be completely different fields,  or even concatenated fields in the same column.?

 

the Column data looks as such:  07/24/2017 18:12:00 

columns.Bound(c => c.CreatedDate).Title("Submitted On")

.ClientTemplate("#= kendo.toString(kendo.parseDate(CreatedDate), 'MM/dd/yyyy HH:mm:ss') #")

.Filterable(ftb => ftb.Cell(cell => cell.Template("DateTimeFilter")));

Georgi
Telerik team
 answered on 28 Jul 2017
6 answers
370 views

Hello, and thank you in advance for any and all help.

I do not know if this is a known bug, something I have discovered, or something I am simply doing wrong.

.Selectable(selectable => selectable
        .Mode(GridSelectionMode.Multiple)
        .Type(GridSelectionType.Row))
.Resizable(resize => resize.Columns(true))
.AllowCopy(true)

 

This is how I have my grids set up. However, I notice copy/paste will fail from the grid unless all columns are showing. I use hideColumn() and showColumn() to allow a user to dynamically select what columns they wish to see. Is this a known issue, or is it a strict requirement that all columns have to be showing for copy/paste to work? Is there a workaround, if that is the case?

Thank you again!

Stefan
Telerik team
 answered on 28 Jul 2017
2 answers
1.2K+ views

I have a application that has a kendo grid.

I can filter the grid using several dropdownlists that are outside the grid.

When I click on search, I add filters to the datasource filter list. For example,

    var dataSource = $("#grid").data("kendoGrid").dataSource;
                var dataSourceFilterQuery = new Array();
   
        if ($("#something").data("kendoDropDownList").value() !== null) {
                        dataSourceFilterQuery.push({ field: "something", operator: "IsGreaterThanOrEqualTo", value: ($("#something").data("kendoDropDownList").value()) });
                }
   
                dataSource.filter(dataSourceFilterQuery);    

Then I get the results I want. It works.
I then have the possibility of saving the values of all the dropdownlists as one filter in localStorage.

     const filtersObject = {
                    Something: whatever.value(),
                    ...
                };
   
                this.storage.setItem("Filter", JSON.stringify(filtersObject));

When I restart the application, the dropdownlists are populated with whatever is in localStorage

    const filter =  JSON.parse(localStorage.getItem("Filter"));
   
                    $("#something").data("kendoDropDownList").value(filters.whatever || "");               
                }

The thing is, I wanted to add these filters, if they exist on localStorage, to the datasource when the application starts so that the user can see the results of the filter he saved when the applications starts and not have to click on search again.

So, what I want is to do apply this

    var dataSource = $("#grid").data("kendoGrid").dataSource;
                var dataSourceFilterQuery = new Array();
   
        if ($("#something").data("kendoDropDownList").value() !== null) {
                        dataSourceFilterQuery.push({ field: "something", operator: "IsGreaterThanOrEqualTo", value: ($("#something").data("kendoDropDownList").value()) });
                }
   
                dataSource.filter(dataSourceFilterQuery);

before the grid is displayed.

Is this possible?

Tks in advance.

Rui
Top achievements
Rank 1
 answered on 27 Jul 2017
2 answers
264 views

I have a page with a Kendo grid and several controls (picture 1).

It works fine, no problem here. I now have to replace the dropdownlist that is open in the picture with a multiselect.

After I changed the drop to a multi, which works just fine, something strange happened ( picture 2).

The layout is all messed up and the grid stopped working.

I change it back to drop and everything is back to normal.

The code for the drop is

 

@(Html.Kendo().DropDownList()

.Name("Name")

.OptionLabel("Select something...")

...

..BindoTo(new List>SelectListItem>

{

...

}}))

 

The code for the multiselect is

@(Html.Kendo.MultiSelect()

.Name("Something")

.PlaceHolde("Select something...")

...

.BindTo(new List<SelectListItem>

{

...

}}))

 

Any ideas?

Rui
Top achievements
Rank 1
 answered on 27 Jul 2017
5 answers
827 views
I have a Grid with template column columns.Bound(p => p.Category).ClientTemplate("#=Category.CategoryName#").Width(180);
When I edit this cell I get a dropdownlist and select values from the list.

Then I added ClientDetailTemplateId to grid and the above column is no more editable.
Could you please help
Stefan
Telerik team
 answered on 27 Jul 2017
3 answers
1.4K+ views

I need to refresh my PieChart using calculation made in my controller using a DatePicker.

Despite the update of the Viewbag used for the series in my controller, It seems that the series are not updated when refreshing the Chart.

Any suggestions ?

MyView :

@(Html.Kendo().DatePicker()
          .Name("startDatepicker")
          .Value(DateTime.Now.ToShortDateString())
          .Events(e =>
          {
            e.Change("onStartDateChange");
          }))
@(Html.Kendo().Chart()
      .Name("chartWorkDuration")
      .Title(title => title.Text("Working time - Total : " +
                                 ViewBag.TotalWorkDuration.ToString() + "h")
                            .Position(ChartTitlePosition.Bottom))
      .ChartArea(chart => chart.Background("transparent"))
      .Series(series => series.Pie(ViewBag.arWorkDuration)
              .Padding(0)
      )
      .Tooltip(tooltip => tooltip
          .Visible(true)
          .Format("{0:N0}")
      )
)
<script>
  function onStartDateChange() {
    var startDate = $("#startDatepicker").data("kendoDatePicker").value().toDateString();
    $.ajax({
      url: 'PlanningGraph/RefreshGraph',
      cache:false,
      data: {
        startDate: startDate
      },
      success: function (xhr, textStatus) {
        $("#chartWorkDuration").data("kendoChart").refresh();
      }
    });
    });
  }
</script>

My Controller

// Creation of my viewmodel elements
....
      var workDuration = graphElementViewModels.Select(w => new
        {
        category = w.strCategory,
        value = w.dblValue,
        color = w.strColor
        });
ViewData["arWorkDuration"] = workDuration;

 

Stefan
Telerik team
 answered on 27 Jul 2017
5 answers
154 views
I have a group-able Kendo grid with a pop-up editor. When the user clicks "New Entry" a new row is created in a new grouping even if the a group already exists for that value. Additionally, if the user clicks "Cancel" the incomplete row and its group is retained. If the user clicks "New Entry" again, the old incomplete entry is removed, but the group is retained.

How do I tell the Kendo Grid to not create a new row until the user has clicked OK for the new entry (and the entry has passed validation)? Is it possible to have this new row correctly placed in the appropriate grouping?

Thanks!
Vasil
Telerik team
 answered on 26 Jul 2017
10 answers
232 views
Hi,

Recently we are trying to migrate our existing application from telerik to Kendo ui controls. In one of the page we have telerik splitter and its panel contains telerik tab strip which internally loads telerik grid.

    Now we replaced telerik splitter to kendo ui splitter and remaining are same in telerik. Once after running the application telerik grid is not being loaded properly.

Please guide me here.

Thanks,
Srikanth
Ivan Danchev
Telerik team
 answered on 26 Jul 2017
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?