Telerik Forums
UI for ASP.NET MVC Forum
2 answers
1.3K+ 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
332 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
888 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.5K+ 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
211 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
301 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
1 answer
350 views
Is there a way to format some text to superscript or subscript while exporting a grid to Excel file? Or any workaround? Thank you very much.
Stefan
Telerik team
 answered on 26 Jul 2017
1 answer
173 views

I found an issue and could not find on forums if anyone else has reported it. The steps are these

1. Grid with column reorder and column menu

2. On a column open the column menu to show/hide columns

3. Reorder the grid columns

4. Open the column menu for the same column => the columns in menu are in the initial state (before reorder)

5. Open column menu for any other column => the columns menu is in the correct state (after reorder)

Questions:

Is this issue going to be fixed in framework? If not is there a workaround for this issue?

On related note: Is there available a custom Widget that simulates the Show/Hide columns menu (having the visibility columns outside of the grid on a button related to this thread Add ColumnMenu To Custom Toolbar On Telerik MVC Grid).

Stefan
Telerik team
 answered on 26 Jul 2017
1 answer
759 views

I've tried using Ajax Binding (and also ToDataSourceResult Binding) from this article to populate a DropDownList. I copy/pasted the exact code from the article into my solution. The GetProducts method on the controller returns 78 products, yet the DropDownList stays empty.

What am I doing wrong?

Controller

public JsonResult GetProducts()
{
    NorthwindDataContext northwind = new NorthwindDataContext();
 
    return Json(northwind.Products, JsonRequestBehavior.AllowGet);
}

 

View

@(Html.Kendo().DropDownList()
    .Name("productDropDownList")
    .DataTextField("ProductName")
    .DataValueField("ProductID")
    .DataSource(source =>
    {
           source.Read(read =>
           {
                read.Action("GetProducts", "Home");
           })
           .ServerFiltering(true);
    })
    .SelectedIndex(0)
)
Nencho
Telerik team
 answered on 25 Jul 2017
1 answer
197 views

I am using the MVC Menu component, and I am using is in a slide out div.  So hit a menu button, a div slides out from the side of the screen, showing menu choices.  However, the menu itself (with a Vertical Orientation) fills up the entire div, and submenu items are not showing up because I assume they're being cut off by the div.  I have tried setting an HtmlAttriibutes on the main menu itself, with a style of z-index: 1000 to ensure it's the top most, but that doesn't work.  I've also tried using PopupCollisions to false, but I guess that's for something else entirely.

So my question is, if a menu is part of a popup or slide out div, how to ensure sub menu items get displayed, and secondly, where do I put in the URLs for these menu items?  All the demos only show the menus, but not what should happen when a menu is clicked?

 

Ivan Danchev
Telerik team
 answered on 25 Jul 2017
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
DropDownButton
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?