Telerik Forums
UI for ASP.NET MVC Forum
3 answers
271 views
Is it possible to make a toggle button to switch between the day, week and month view in a bar chart? 
Iliana Dyankova
Telerik team
 answered on 11 Apr 2016
3 answers
125 views
Hi,
I have problem with pannable key and events in diagram.

If I have Pannable key = "None"  (Pannable(p=>p.Key(DiagramPannableKey.None)))
then events Select and Click are dysfunctional.

I need Select event and pannable key = "None".
How can I solve this problem ?

Thanks
Daniel
Telerik team
 answered on 11 Apr 2016
3 answers
160 views

Hello

We have a Listview that populates with an IEnumerable<object>  The data source is set and the read called when a Kendo DropdownList.Change Event is called.

We have found that the first 1/2 the records with generate elements with data-uid, role="option" & aria-selected="false", while the latter 1/2 do not.  There is no difference in the records, if we add a single record to the list at a time, it will produce the same result, the first 1/2 with, the second 1/2 without.

 

we are using an external template (pls see below):

<script type="text/x-kendo-tmpl" id="availableAccessRightsTemplate">
<div style="padding: 8px 0 8px 10px;letter-spacing:.2px;">
<span data-toggle="tooltip" title="#= Description#">    #= DisplayName#   </span>
</div>
<hr style="margin-top: 0;margin-bottom: 0;" />
</script>

 

We see this behavior on 2 different ListViews, albeit on the same page with the same data types (objects).

 

Thanks for your help in advance

Nikolay Rusev
Telerik team
 answered on 11 Apr 2016
2 answers
1.1K+ views

So, I've tried to get this working following many threads and articles and I can't get it to work. The value posts back to the controller fine, but I can't get it to set the default selected item on the DropDownList nor can I get it to display the text of the selected item when I select an option. If I use a client template to try and grab the text, it throws an error (Cannot read property 'Text' of null) and won't show any items in the grid. For this one, I'm not using just an IEnumerable list of ViewModels (like most of the examples show) to populate the DropDownList, I'm using a SelectList. I have it working fine in another project with an IEnumerable list of ViewModels, but I just can get it working with a SelectList and I don't want to create a ViewModel for these static options. Please help! Thanks!

Here's my grid:

@(Html.Kendo().Grid<Tracker.Areas.Admin.Models.AdHocLocationViewModel>()
                                .Name("gridAdHocLocations")
                                .Columns(columns =>
                                {
                                    columns.Bound(c => c.LocationName).Title("Reviewer Location");
                                    columns.Bound(c => c.Packet).Title("Added to");
                                    columns.Bound(c => c.CreateDt).Title("Date Added").Width(120).Format("{0:MM/dd/yyyy}");
                                    columns.Bound(c => c.Action).Title("Selection").ClientTemplate("#=Action.Text#").Width(180);
                                })
                                .Editable(e => e.Mode(GridEditMode.InCell))
                                .ToolBar(t => t.Save())
                                .Sortable()
                                .Pageable(pageable => pageable
                                    .Refresh(true)
                                    .PageSizes(true)
                                    .ButtonCount(5))
                                .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .PageSize(20)
                                    .Batch(true)
                                    .ServerOperation(false)
                                    .Model(s =>
                                    {
                                        s.Id(model => model.LocationId);
                                        s.Field(f => f.LocationName).Editable(false);
                                        s.Field(f => f.Packet).Editable(false);
                                        s.Field(f => f.CreateDt).Editable(false);
                                        s.Field(p => p.Action).DefaultValue(
                                            ViewData["defaultAction"] as SelectListItem);
                                    })
                                    .Read(read => read.Action("LocationsAdHoc_Read", "Location"))
                                    .Update(update => update.Action("LocationsAdHoc_Update", "Location"))
                                )
                            )

Here's my editor (I've also tried it strongly typed using DropDownListFor):

@(Html.Kendo().DropDownList()
    .Name("Action")
    .DataValueField("Value")
    .DataTextField("Text")
    .OptionLabel("Select Action")
    .BindTo((SelectList)ViewData["actions"])
)

Here's my model:

public class AdHocLocationViewModel
    {
        [ScaffoldColumn(false)]
        public int LocationId { get; set; }
        public string LocationName { get; set; }
        public string Packet { get; set; }
        public int ActionId { get; set; }
        public DateTime CreateDt { get; set; }
 
        [UIHint("AdHocLocationEditor")]
        public SelectListItem Action { get; set; }
    }

Ed
Top achievements
Rank 1
 answered on 08 Apr 2016
5 answers
194 views

Hi, 

When I'm using the export to excel function it works fine. But once I add an aggregate to the datasource as in one of the demos, I get the error attached.

Is one of my configurations wrong?

Your help will be much appreciated.

Thanks,

Waldo

My Code is as follows: 

 

@helper TreeGrid()
{
    <div>
    @(Html.Kendo().TreeList<OrgStructureViewModel>()
        .Name("treelist")
        .Columns(columns =>
        {
            columns.Add().Field(e => e.Full_Name)
               .FooterTemplate("<strong>#= count # employee(s)</strong>");
            columns.Add().Field(e => e.Emp_No);
            columns.Add().Field(e => e.Man_No).Hidden(true);
            columns.Add().Field(e => e.Division_ID).Template("#= Division #");
            columns.Add().Field(e => e.Title);
            columns.Add().Command(c => { c.Edit(); c.Destroy(); }).Width(220);
        })
        .Toolbar(x => { x.Create();  x.Excel(); x.Pdf(); })
        .Editable(x => x.Mode("popup"))
        .Filterable()
        .ColumnMenu(true)
        .Scrollable(true)
        .Sortable()
        .Resizable(true)
        .Excel(excel => excel
            .FileName("Reporting_Line.xlsx")
            .ProxyURL(Url.Action("Export_Save", "Reporting_Line"))
        )
        .Pdf(pdf => pdf
            .FileName("Reporting_Line.pdf")
            .ProxyURL(Url.Action("Export_Save", "Reporting_Line"))
        )
        .Events(ev => ev.Edit("onEdit"))
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("Reporting_LineRead", "OrgStructure"))
            .Update(update => update.Action("Reporting_LineEdit", "OrgStructure"))
            .Create(create => create.Action("Reporting_LineAdd", "OrgStructure"))
            .Destroy(delete => delete.Action("Reporting_LineDelete", "OrgStructure"))
             .ServerOperation(false)
             .Aggregates(aggr =>
             {
                 aggr.Add(e => e.Full_Name).Count();
             })
            .Model(m =>
            {
                m.Id(f => f.Reporting_Line_ID);
                m.ParentId(f => f.ReportsTo);
                m.Field(f => f.Emp_No);
                m.Field(f => f.Man_No);
                m.Field(f => f.Division_ID);
                m.Expanded(false);
 
            })
        )
    )
}

 

 

<script type="text/javascript">   
    function onEdit(e) {
        console.log(e);
        if (!e.model.isNew()) {
            $("#Emp_No").data("kendoComboBox").enable(false);
        } else {
            $("#Division_ID").data("kendoDropDownList").enable(false);           
        }
    }
 
    function filterEmployees() {
        console.log($("#Emp_No").data("kendoComboBox").value());
        return {
            empNo: $("#Emp_No").data("kendoComboBox").value(),
            text: $("#Man_No").data("kendoComboBox").text()
        };
    }
</script>

 

​

Alex Gyoshev
Telerik team
 answered on 08 Apr 2016
2 answers
73 views

Hey,

I would like to pass an ID to my controller when the update event is fired on my grid.  Has anyone done this before?

.Update(update => update.Action("data_update", "Home"))

Viktor Tachev
Telerik team
 answered on 08 Apr 2016
2 answers
260 views
Hi, as i'm new to these forums, i hope you will not be to hard on me if the solutions is obvious :-)


Let's say i have setup this grid with Products including a foreign key dropdownlist to ProductTypes. Some of these ProductTypes are no longer in use (marked boolean property 'IsValid')
The requirement is that all Products with ProductType are shown independent of the 'IsValid property'. So far so good.
Now the point where i need some help: when a record is added, i would like the ProductType dropdown to only list ProductTypes that are marked as valid. And to make it even more difficult: When a row is in edit mode, i would like the dropdown to only show the valid ProductTypes AND the current ProductType even if that is invalid.
public class ProductController : Controller
    {
        private DBEntities db = new DBEntities ();
 
        public ActionResult Index()
        {
            ViewData["ProductTypes"] = db.ProductTypes.Select(b => new { Id = b.idProductType, Name = b.ShortName });
            return View();
        }

@(Html.Kendo().Grid<Data.EF.Models.Product>()
      .Name("grid")
      .Columns(columns =>
      {
          columns.Bound(c => c.Code);
           columns.Bound(c => c.Color);
          columns.ForeignKey(c => c.idProductType,
(System.Collections.IEnumerable)ViewData["ProductType"], "Id", "Name").Title("Type");
          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
      })
      .ToolBar(toolbar => {
          toolbar.Create();
          toolbar.Excel();
      })
      .Editable(editable => editable.Mode(GridEditMode.InLine))
      .Sortable(sortable => {
          sortable.SortMode(GridSortMode.MultipleColumn);
      })
      .Filterable()
      .Scrollable(scrollable => scrollable.Enabled(false))
      .DataSource(dataSource => dataSource
          .Ajax()
          .Model(model => model.Id(p => p.idProduct))
          .Read(read => read.Action("KProduct_Read", "Product"))
          .Create(create => create.Action("Product_Create", "Product"))
          .Update(update => update.Action("Product_Update", "Product"))
          .Destroy(destroy => destroy.Action("Product_Destroy", "Product"))
      )
)
Nikolay Rusev
Telerik team
 answered on 08 Apr 2016
14 answers
1.0K+ views

I have these model classes:

public class Part
{
    public Guid Id { get; set; }
    string Name { get; set; }
    public Part()
    {
    }
}
 
public class DetailItem
{
    public Guid Id { get; set; }
    public Part Part { get; set; }
 
    public DetailItem()
    {
    }
}

In my View, the model is the DetailItem. I am trying to use a ComboBox to select the Part for the DetailItem:

 

@(Html.Kendo().ComboBoxFor(model => model.Part)
    .DataValueField("Id")
    .DataTextField("Name")
    .Filter(FilterType.Contains)
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetParts", "RefData");
        })
 
        .ServerFiltering(true);
    }
    )
)

When I save the page, the DetailItem.Part never gets set from the ComboBox. How do I make this work?
Bill Wingate
Top achievements
Rank 1
 answered on 07 Apr 2016
4 answers
297 views

I have a grid with a large data set and I have a button that clears filters and sorting but each one causes a refresh of the data:

    $(function () {
        $("#reset").click(function (e) {
            e.preventDefault();
            var datasource = $("#grid").data("kendoGrid").dataSource;
            //Clear filters:
            datasource.filter([]);

          //Clear sorting:
            datasource.sort({});
        });
    });

Is there a way to combine this to only refresh the data once.

Thanks,

Erik

Erik
Top achievements
Rank 2
 answered on 07 Apr 2016
1 answer
357 views

I've got a ComboBox which uses Grouping and I'm having trouble setting the selected item:

            @(Html.Kendo().ComboBox()
                  .Name("GroupedList")
                  .Placeholder("Select...")
                  .DataValueField("Value")
                  .DataTextField("Text")
                  .MinLength(3)
                  .Filter("contains")
                  .HtmlAttributes(new { style = "width:100%;" })
                  .Height(400)
                  .DataSource(source => source
                      .Custom()
                      .Group(g => g.Add("GroupKey", typeof(string)))
                      .Transport(transport => transport
                          .Read(read =>
                          {
                              read.Action("GetMyItems", "MyController");
                          })
                      )
                      .ServerFiltering(false)
                  )
            )

My controler is returning JSON in the following format with one of the items optionally having "Selected":true

[{"GroupKey":"Address","GroupName":"Address","Selected":false,"Text":"Correspondence Post Code","Value":"821"},...etc..]

Ivan Danchev
Telerik team
 answered on 07 Apr 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
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
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?