Telerik Forums
UI for ASP.NET MVC Forum
3 answers
440 views

I have a chart which has too many values to fit comfortably on the screen all at once.

 I have made it pannable and zoomable as per the demo example.  This works, but the chart initially still opens with all the columns squashed onto the screen.

How can I set a fixed zoom level (which the user can't change) to enable panning of the chart?

Also, will a scrollbar or other visual indicator that a chart can be panned be added soon? Currently it's not very user friendly, and requires an application to find a way to tell users how to scroll the chart. Alternatively, can panning be activated by JavaScript, so some left / right buttons can be added?

The chart code is:-

@(Html.Kendo().Chart<Dashboard.Models.BarChartDataItem>(Model)
            .Name((string)ViewBag.ChartName)
             .Title((string)ViewBag.ChartTitle)
             .Theme("bootstrap")
            //.RenderAs(RenderingMode.Canvas)              
 
            .Legend(legend => legend
                .Position(ChartLegendPosition.Top)
                .Visible(false)
            )
     
            .Series(series =>
            {
                series.Column(model => model.BarValue).Name("Actual").Labels(l=>l.Template("#=dataItem.ExtraValue#").Visible(true));
            })
            .ChartArea(area => area
                .Height(350)
                .Background("transparent")
                )
            .CategoryAxis(axis => axis
 
 
                .Categories(model => model.AxisValue)
                .Labels(labels => labels.Rotation(-90))
                .MajorGridLines(lines => lines.Visible(false))
                 .Title((string)ViewBag.Xaxis)
 
            )
            .Pannable(p=>p.Lock(ChartAxisLock.Y))
             .Zoomable(zoomable => zoomable
            .Mousewheel(mousewheel => mousewheel.Lock(ChartAxisLock.Y))
            .Selection(selection => selection.Lock(ChartAxisLock.Y))
        )
 
            .ValueAxis(axis => axis.Numeric()
                .Labels(labels => labels.Format("{0:N2}"))
                .Title((string)ViewBag.Yaxis)
 
 
                .Line(line => line.Visible(false))
            )
            .Events(e=>e.SeriesClick("seriesClick"))
 
            .Tooltip(tooltip => tooltip
                .Visible(true)
 
                .Format("{0:N2}")
            )
 
)

Thanks

 

Daniel
Telerik team
 answered on 16 Nov 2015
5 answers
818 views

Hi.

 

I would like to open multiple popup windows from ActionLinks within a grid.

The column template for the single-column grid is such...

        string Template =
            "<tr>" +
                "<td>" +
                    "<div class='ResultListing'>" +
                        "<div class='Technical'>" +
                            Ajax.ActionLink("#:CompanyName#, #:MfgModelNumber#", "GetDetails", "Services", new { ComponentID = "#:ComponentID#" },

                                       new AjaxOptions() { HttpMethod = "POST" }, new { @class = "ResultsTitle" }) + "<br />" +

                            "<span>MPN: #:MfgPartNumber#</span><br/>" +
                            "<span>Key: #:ConfigurationKey#</span><br/>" +
                        "</div>" +
                        "<div class='Space'>" +
                        "</div>" +
                        "<div class='Technical'>" +
                            "<span>Description: #:DesignDescription#, #:CategoryDescription# </span><br/>" +
                            "<span>Elastomers: #:(Elastomers == '0') ? 'N/A' : Elastomers#; Materials: #:(Materials == '0') ? 'N/A' : Materials#</span><br/>" +
                            "<span>Sizes: #:(Sizes == '0') ? 'N/A' : Sizes#; </span><br/>" +
                            "<span>Configuration: #:Configurations# </span><br/>" +
                            "<span>Leyla ID: #:ComponentID# (#:ComponentStatus#)</span>" +
                        "</div>" +
                        "<div id='PictureDiv' class='ControlAndLabel AlignCenter'>" +
                            "# if (URL.length > 0) { #" +
                                "<img src='#:URL#' class='ComponentImg'/><br/>" +
                                "<span>#:ImageDescription#</span>" +
                            "# } else { #" +
                                "&nbsp;" +
                            "# } #" +
                        "</div>" +
                    "</div>" +
                "</td>" +
            "</tr>"
            ;

​The Ajax.ActionLink should be able to open a new popupwindow based on the ID contained in the grid for that row.  The controller will return a partial view to the popup window...

 

        [HttpPost]
        public PartialViewResult ​GetDetails(int ComponentID)
        {

            PartialViewResult Result = PartialView("_ComponentDetailView", ComponentID);

            return (Result);
        }

The popup windows are not modal, so that multiple ​popups can be opened at the same time.  The user can click multiple links from the grid, popping up multiple detail windows at the same time.

 

The detail popups should fetch data from a database only when activated.

I am rather new to MVC and to the Kendo tools.  At this point, I am not even sure this is the best way to do it.  I am hoping a new Kendo Window can be instantiated ​by clicking the Action link in the grid and populated by somehow passing in the id of the object whose details the user wants to see.

Any help would be appreciated.

Daniel
Telerik team
 answered on 16 Nov 2015
1 answer
724 views

Hi,

 I have a Grid with client detail template. The grid  has only one column to display and the client detail template is given below

 <script id="client-template" type="x-kendo-template">

    <div onclick="OnDivClick" class="row">
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>First Name</label>
                <p>#: FirstName #</p>
            </div>
        </div>
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>Last Name</label>
                <p>#: LastName #</p>
            </div>
        </div>
        <div class="col-lg-1 col-md-3 col-sm-12">
            <div class="form-group">
                <label>Inhouse</label>
                <p>#: Inhouse #</p>
            </div>
        </div>
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>Company Name</label>
                <p>#: CompnayName #</p>
            </div>
        </div>
        <div class="col-lg-1 col-md-3 col-sm-12">
            <div class="form-group">
                <label>SAN</label>
                <p>#: StateAccountNumber #</p>
            </div>
        </div>
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>Location Number</label>
                <p>#: LocationNumber #</p>
            </div>
        </div>
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>Last Activity Date</label>
                <p>#: LastActivityDate #</p>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>First Name from Payroll</label>
                <p>#: ClaimentFirstName #</p>
            </div>
        </div>
        <div class="col-lg-2 col-md-3 col-sm-12">
            <div class="form-group">
                <label>Last Name from Payroll</label>
                <p>#: ClaimentLastName #</p>
            </div>
        </div>
        <div class="col-lg-8 col-sm-12 col-md-6">
            <button class="btn btn-success col-lg-offset-11 col-md-offset-9">Select</button>
        </div>       
    </div>

</script>

 

I need to select both row and client detail template of the row when we click in the client detail template area or click the button inside the client detail template.

For this I have used the onclick event of the div. But it is not working.

Also I need to get the row data when we click in the client detail template area or click the button inside the client detail template.

Can any one provide the solution for this .

Radoslav
Telerik team
 answered on 16 Nov 2015
2 answers
276 views

Hello,

I have hierarchical data in DB implemented as closure table. Imagine hundreds of nodes with parent-child relationship. Now I would like to display data, edit nodes, create new nodes, change hierarchy with drag&drop, filter nodes (show only nodes which starts with given word).

TreeList has this CRUD operations ready for use, but I was not able to detect drag&drop event for persisting the change in DB. Yes, its possible to add the button for "save", but I would like to do the change automatically.

So I tried TreeView. TreeView with popup-menu for adding root node, child node, etc. But I have problem with "editing". When I use demo for edit node in separate form, loading child's node stops working.

So, I would like to ask for hint or complex example of CRUD operations in TreeView or maybe to say me, that TreeView is not intended for this operations :)

Thank you

 

Radoslav
Top achievements
Rank 1
 answered on 13 Nov 2015
4 answers
582 views

I am using Kendo MVC Treeview.

How can I change font for all parents that has child nodes.

Thank You.

Arun
Top achievements
Rank 1
 answered on 13 Nov 2015
1 answer
110 views
We need to reference to #JustNum, but we don’t find anyway to do it.

@using SGIRO2014.Models;
@model object
 
<script type="text/javascript">
    function ChangeDocType(e) {
        $("#JustNum").prop("disabled", (this.value() == @((short)documentType.FI)));
    }
</script>
 
@(Html.Kendo().DropDownListFor(m => m)
    .HtmlAttributes(new { style = "width:100px" })
    .ValuePrimitive(true)
    .OptionLabel("-please select-")
    .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
    .Events(e => e.Change("ChangeDocType"))      
)
  
@Html.Kendo().TextBoxFor(m => m).Name("DocNum").HtmlAttributes(new { style = "width:100px" })
  
@Html.Kendo().TextBoxFor(m => m).Name("JustNum").HtmlAttributes(new { style = "width:40px", maxlength = "2" })

 

 

Thanks in advance

 

 

Xavier de la Rubia.

Boyan Dimitrov
Telerik team
 answered on 13 Nov 2015
1 answer
335 views

I want to create a view with a layout similar to Outlook or the Team Efficiency page of the Telerik Northwind Dashboard sample app.  There will be a ListView of names on the left.  When you click on a name, more information about the person will appear in a side panel to the right.  So far, so good.  On phones and other ​small screens, I need this ​view to function as Outlook does on those devices.  Only the ListView should be visible until you click on a name, ​at which time the side panel will be displayed and the ListView will no longer be visible. That's where I need some help.

What's the best way to go about this using Telerik controls? I am using Bootstrap to control the layout, but this is a little different since it is not based just on the size of the screen.

Thanks,

Joel

Georgi Krustev
Telerik team
 answered on 13 Nov 2015
1 answer
93 views

I have an Hierarchical Grid and a problem appears when the first row is expanded before another row:

If I insert any record to any child grid, it record will be inserted for the first row's parent grid (in database too).

My Grid:

@(Html.Kendo().Grid<AvvaWebApi.Models.DataFilterViewModel>()
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns
                            .Bound(c => c.Alias)
                            .Title("Nome de identificação")
                            .Width(300);


                        columns.Bound(c => c.Zone)
                            .ClientTemplate("# if (typeof Zone !== 'undefined' && Zone !== null) {# #=Zone.Number# #} else {# N/A #} #")
                            .EditorTemplateName("Zone")
                            .Title("Zona de Alarme")
                            .Filterable(false)
                            .Width(130);

                        columns
                            .Bound(c => c.AlarmType)
                            .ClientTemplate("# if (typeof AlarmType !== 'undefined' && AlarmType !== null) {# #=AlarmType.Text# #} else {# N/A #} #")
                            .EditorTemplateName("AlarmType")
                            .Title("Tipo de Alarme")
                            .Filterable(false);

                        columns
                            .Bound(c => c.OutputText)
                            .Title("Texto de saída");

                        columns
                            .Bound(c => c.DigitalOutput).Title("Saída digital")
                            .EditorTemplateName("Integer")
                            .Width(110)
                            .Filterable(false);

                        columns
                            .Bound(c => c.TurnOnGiroflex)
                            .Title("Ligar Giroflex")
                            .Width(110)
                            .Filterable(false)
                            .ClientTemplate("# if(TurnOnGiroflex) { #&#10004;# } else { #&mdash;# } #");

                        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
                    })
                    .ToolBar(toolbar =>
                    {
                        toolbar.Create();
                    })
                    .Editable(editable => editable.Mode(GridEditMode.InLine))
                    .Pageable()
                    .Filterable()
                    .Scrollable()
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Model(model => model.Id(p => p.Id))
                        .Model(model => model.Field(p => p.AlarmTypeId).DefaultValue(1))
                        .Model(model => model.Field(p => p.ZoneId).DefaultValue(1))
                        .Read(read => read.Action("DataFilters_Read", "DataFiltersGrid"))
                        .Create(create => create.Action("DataFilters_Create", "DataFiltersGrid"))
                        .Update(update => update.Action("DataFilters_Update", "DataFiltersGrid"))
                        .Destroy(destroy => destroy.Action("DataFilters_Destroy", "DataFiltersGrid"))
                    )
                    .Events(events => events.DataBound("dataBound"))
                    .HtmlAttributes(new { style = "height: 533px;" })
                    .ClientDetailTemplateId("templateConditions"))

 

The template Grid:

 

<script id="templateConditions" type="text/kendo-tmpl">

    @(Html.Kendo().Grid<AvvaWebApi.Models.ConditionViewModel>()
      .Name("gridCondicoes")
      .Columns(columns =>
      {
          columns.Bound(c => c.OrdinalPosition)
            .Title("Ordem de precedência")
            .EditorTemplateName("Integer")
            .Width(100);

          columns.Bound(c => c.LogicOperator)
            .Title("Operador condicional")
            .ClientTemplate("\\# if (typeof LogicOperator !== 'undefined') {\\# \\#=LogicOperator.Text\\# \\#} \\#")
            .EditorTemplateName("LogicOperator")
            .Width(170);

          columns
            .Bound(c => c.Analytic)
            .Title("Onde aconteceu?")
            .ClientTemplate("\\# if (typeof Analytic !== 'undefined') {\\# \\#=Analytic.Alias\\# \\#} \\#")
            .EditorTemplateName("CascadedAnalytic");

          columns.Bound(c => c.EventType)
            .Title("O que aconteceu?")
            .ClientTemplate("\\# if (typeof EventType !== 'undefined') {\\# \\#=EventType.Text\\# \\#} \\#")
            .EditorTemplateName("EventType")
            .Width(250);

          columns.Bound(c => c.SecondsSinceLast)
            .Title("Segundos depois")
            .EditorTemplateName("Integer")
            .Width(100);

          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
      })
      .ToolBar(toolbar =>
      {
          toolbar.Create();
      })
      .Editable(editable => editable.Mode(GridEditMode.InLine))
      .Scrollable()
      .DataSource(dataSource => dataSource
          .Ajax()
          .ServerOperation(false)
          .Sort(sort => sort.Add(x => x.OrdinalPosition).Ascending())
          .Model(model => model.Id(p => p.Id))
          .Model(model => model.Field(p => p.AnalyticId).DefaultValue(1))
          .Model(model => model.Field(p => p.LogicOperatorId).DefaultValue(1))
          .Model(model => model.Field(p => p.EventTypeId).DefaultValue(1))
          .Read(read => read.Action("Conditions_Read", "ConditionsGrid", new { dataFilterId = "#=Id#" }))
          .Create(create => create.Action("Conditions_Create", "ConditionsGrid").Data("onCreateCondition"))
          .Update(update => update.Action("Conditions_Update", "ConditionsGrid"))
          .Destroy(destroy => destroy.Action("Conditions_Destroy", "ConditionsGrid"))
      ).ToClientTemplate()
    )
</script>

 

Anyone had this problem anytime?​

Alexander Popov
Telerik team
 answered on 12 Nov 2015
1 answer
240 views

Hi,

I need some help with the aggregate feature please. The sum aggregates are not displayed at the footer of the grid. The correct data is received however.

I Have an MVC backend and use the DatasourceRequest object, but because of the fact I am using angular, I cannot work with the MVC wrappers. Therefore I use the following JS for the grid options:

$scope.gridOptions = {
                // 1. DATASOURCE
                "dataSource": {
                    "type": 'aspnetmvc-ajax',
                    "transport": {
                        "read": { "url": myReadUrl() },
                        "update": { "url": myUpdateUrl() },
                        "create": { "url": myCreateUrl() },
                    },
                    "serverPaging": true,
                    "pageSize": 20,
                    "serverSorting": true,
                    "serverFiltering": true,
                    "sort": { "field": "Datum", "dir": "desc" },
                    "schema": {
                        model: {
                            "id": "Id",
                            "fields": {
                                "Id": { "type": "number" },
                                "Datum": { "type": "date", validation: { required: true } },
                                "​CountOk": { "type": "number", "validation": { required: true, min: 0 } },
                            },
                        },
                        "data": "Data",
                        "total": "Total",
                        "errors": "Errors",
                        "aggregates": "AggregateResults"
                    },
                    "serverAggregates": true,
                    "aggregate": [field: "​CountOk", aggregate: "sum" },  ]
 
                },
                // 2. COLUMNS
                "columns": [
                    {
                        "title": "Date",
                        "field": "Datum",
                        "format": "{0:d}",
                    }, {
                                "title": "OK",
                                "field": "CountOk",
                                "width": 100,
                                "format": "{0:0}",
                                "aggregates": ["sum"],
                     }, {
                        "command": [
                            { "name": "edit", "buttonType": "ImageAndText" },
                        ],
                    }
                ],
 
                // 3. GRID FEATURES
                "editable": {
                    "mode": "inline",
                    "create": true,
                    "update": true,
                    "destroy": false
                },
                "toolbar": [
                    { "name": 'create', "buttonType": "ImageAndText", "text": "​New" },
                ],
                "pageable": true,
                "sortable": true,
                "scrollable": true,
                 },
            }; 

 

 The received data contains the values, but it seems MVC datasource added some things here:

{"Data":[{"Id":5,"ItemId":4,"Datum":"\/Date(1447023600000)\/","CountOk":3}],"Total":1,
"AggregateResults":[{"Value":3,"Member":"CountOk","FormattedValue":3,"ItemCount":0,"Caption":null,"FunctionName":"Sum_CountOk_21409671","AggregateMethodName":"Sum"}],"Errors":null}

 

Thank you so much for helping me out here!

 

Daniel
Telerik team
 answered on 12 Nov 2015
1 answer
127 views

My upload control works fine for the first file but not the second.  The "Select" box still allows me to pick a second file, but no events fire.  The files I'm using are very small (a few K) so the first upload is almost instant.

 Here is my control:

 

@(Html.Kendo().Upload()
       .Name("invoiceUpload")
       .Multiple(true)
       .ShowFileList(true)       
       .HtmlAttributes(new { style = "margin-bottom: 10px;" })
       .Async(a => a
           .Save("Invoice", "Upload", new { format = @Model.Format })
           .AutoUpload(true)
       )
       .Events(events => events
           .Success("onSuccess")
           .Select("onSelect")
           .Error("error_handler")
           .Upload("onUpload")
           )
       )

 

The JS events are just alerts to see if anything is happening, they all fire the first time but none for for subsequent file selects.

 I know I'm not giving a ton of info, hoping I'm just missing something obvious.  Please let me know if you need more info.  Thanks in advance to any responders.

 

 

Dimiter Madjarov
Telerik team
 answered on 12 Nov 2015
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
Licensing
Rating
ScrollView
ButtonGroup
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
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
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?