Telerik Forums
Kendo UI for jQuery Forum
3 answers
226 views
Is it possible to build a Chart in the MVC Control and pass it to the View in the Model?  I want to do this so that I can dynamically display a chart based on the desired dashboard layout.  So I want the View to dictate where the charts are displayed but I want the View to be ignorant of the reports content.  Let me know if I haven't explained what I want to do well enough or if there is a better way.  I plan to have the dashboard layouts and which reports those contain stored in a database.

This is a "mark up"
View
@model ChartCollection
@{
    ViewBag.Title = "Dashboard";
}
<h2>
    Dashboard
</h2>
@Html.Partial("_Report1", Model["ValidationResults"])
@Html.Partial("_Report2", Model["ClientComponents"])

ChartCollection(Model)
public class ChartCollection : Dictionary<string, IChart>
{
}
Controller
01.public class HomeController : Controller
02.{
03.    public ActionResult Index()
04.    {
05.        ViewBag.Message = "Welcome to ASP.NET MVC!";
06. 
07.        return View();
08.    }
09. 
10.    public ActionResult About()
11.    {
12.        ChartCollection charts = new ChartCollection();
13. 
14.        IChart chart;
15. 
16.        /// How do I duplicate this logic in the Controller?
17.         @(Html.Kendo().Chart()
18.            .Name("ClientComponents")
19.            .Title("Components")
20.            .DataSource(ds =>
21.                    {
22.                        ds.Model(model =>
23.            {
24.                            foreach (DataColumn col in Model.QueryResults.Columns)
25.                            {
26.                                model.Field(col.ColumnName, col.DataType);
27.                            }
28.                        });
29.                    }
30.            )
31.        .Legend(legend => legend.Visible(true).Position(ChartLegendPosition.Bottom))
32.        .Series(series => series.Bar(new int[] {2,4,6}).Name("MyValues"))
33.        .CategoryAxis(yaxis => yaxis.Categories(new string[] {"Hello", "World"}))
34.        .Tooltip(tip => tip.Visible(true)) )
35. 
36.        /// Add the IChart to the ChartCollection
37.        charts.Add(chart.Name, chart)
38.        return View(charts);
39.                }
40.            }
T. Tsonev
Telerik team
 answered on 23 Aug 2013
5 answers
267 views
Hi

I discovered an issue when use a Scroller with ListView mobile control. The following example might help to better explain the problem.

<div data-role="view" data-title="Test View" id="testView">
    <div>
        <input type="search" value="" id="searchfor" class="k-textbox" placeholder="Search..." />
    </div>
    <div data-role="scroller">
        <ul data-role="listview" id="customersListview" data-type="group"></ul>
    </div>
</div>
In this example there is a <div> area followed by the Scroller that contains a ListView control and list view items are populated in JavaScrip.
If I try this as it is, when scroll the items in the list view it also scrolls the <div> above the scroller and pushes the Search box outside of the screen.
The fix to this problem is to set a "Height" for the scroller but problem is that I want the list covers the rest of the screen on the device and height of the screen depends on the type of the device and I cannot specify a fixed height for the scroller that works on all types of the devices.
Is there any way to have this working without setting a fixed height?

Thanks
Ron
Kiril Nikolov
Telerik team
 answered on 23 Aug 2013
1 answer
229 views
I need to change the decimal separator to "," or, even better, apply a globalization-setting like 'de-DE' in a mobile environment, just
like the globalization demo for web applications: http://demos.kendoui.com/web/globalization/index.html

But when i try e.g.

  $("#amount").kendoNumericTextBox({
      format: "c2" //Define currency type and 2 digits precision
  });

i only get: '$("#amount").kendoNumericTextBox' is not a funtion. what should i do?

TIA Peter

Alexander Valchev
Telerik team
 answered on 23 Aug 2013
6 answers
1.0K+ views
Hello,

I would like the tree view to be much bigger to be used with more ease on mobile.
What is the recommended way to increase the font size and preserving the features like drag & drop, and selected items.

Thank you
Frederic
Top achievements
Rank 1
 answered on 23 Aug 2013
1 answer
173 views
is there any possibility to add multiple drop down list (cascade drop down list)to editor template as resources. 
Georgi Krustev
Telerik team
 answered on 23 Aug 2013
1 answer
142 views
For some reason I seem to be unable to get any more than the following in the Kendo UI Grid:

HTML: 
<div id="grid"></div>
<script>
    var remoteDataSource = new kendo.data.DataSource(
    {
        transport:
        {
            read: {
                type: "POST",
                dataType: "json",
                url: "/home/getopportunities/"
            }
        },
        pageSize: 4
    })
    $("#grid").kendoGrid(
        {
            dataSource: remoteDataSource,
            columns: [
                {
                    title: "Title",
                    headerAttributes: {
                        style: "text-align:center"
                    },
                    attributes: {
                        "class": "table-cell"
                    },
                    width: 600,
                    filterable: true
                },
                {
                    title: "Activity Type",
                    headerAttributes: {
                    },
                    attributes: {
                        "class": "table-cell",
                        style: "text-align:center"
                    },
                    width: 100,
                    filterable: true
                },
                {
                    title: "Specialty",
                    filterable: true,
                    headerAttributes: {
                        style: "text-align:center"
                    },
                    attributes: {
                        "class": "table-cell",
                        style: "text-align:center"
                    }
                },
            {
                title: "Total Credits",
                format: "{0}",
                headerAttributes: {
                    style: "text-align:center"
                },
                attributes: {
                    "class": "table-cell",
                    style: "text-align:center"
                }
            }
        ],
        height: 430,
        scrollable: true,
        sortable: true,
        pageable: true,
        filterable: {
            extra: false,
            operators: {
                string: {
                    contains: "Contains",
                    startswith: "Starts with",
                    eq: "Is equal to",
                    neq: "Is not equal to"
                },
                number: {
                    eq: "Is equal to",
                    neq: "Is not equal to",
                    gte: "Greater Than",
                    lte: "Less Than"
                }
            }
        }
    });
</script>
This is the JSON as the browser sees it:
[
{"ActivityID":367,"Title":"Non Webinar Test For Calendar","ActivityType":"Other","TotalCredits":2,"Specialty":"[AB] [AE]"},
{"ActivityID":370,"Title":"Stage - Test SI Changes Part II","ActivityType":"Other","TotalCredits":2,"Specialty":"[NE]"},
{"ActivityID":374,"Title":"Webinar Test Event For Calendar","ActivityType":"Webinar","TotalCredits":2,"Specialty":"[FE] [NE] "},
{"ActivityID":401,"Title":"Module #1 Webinar: Learn Stuff","ActivityType":"Webinar","TotalCredits":2,"Specialty":"[AB] ",},
{"ActivityID":403,"Title":"Module #3 Webinar: Learn Even More Stuff","ActivityType":"Webinar","TotalCredits":2,"Specialty":"[AB] [AE]",}
]


I think I'm really close but can't make the last step to getting it working.  All I get is a blank grid after the spinner runs.
Kiril Nikolov
Telerik team
 answered on 23 Aug 2013
1 answer
393 views
Hi, we need to know if there is a way to identify if the dataBound event was triggered because a filter was applied or a pagination action was perform. Please someone that can help us.

Thanks in advance.

Alexander Valchev
Telerik team
 answered on 23 Aug 2013
0 answers
91 views
Dear Members, 

I am using Grid load tons of listing under Kendo Grid where Ajax  Pre-loader is important.  It stopped working when  we bind anything with Grid. 

When you use data-bind with Grid the Ajax  Pre-loader is lost but it fetches data after sometimes. My wont wait until they see a Ajax  Pre-loader.

Can anyone share any code sample to show  Ajax  Pre-loader for Grid with bind example under MVVM framework.   

Mohammed Nazrul
Top achievements
Rank 1
 asked on 22 Aug 2013
3 answers
167 views
Hello, 

I have used your example and I have found a problem with the button "back".
In your example on the left side of the screen there are categories. When is chosen a category, a list of products appears.
If I want to see the categories again, I have to press the button “back”.
The issue appears when I press the button "back" twice and after that I chose a category. When I chose a category, appears a list with products, but when I press the button “back” the button doesn’t work.
Steps:
1. Chose a category
2. Press the button "back" twice
3. Chose category again
4. See products
5. Press the button "back"
Result: User cannot go back in categories .

How could be avoid this case?
Alexander Valchev
Telerik team
 answered on 22 Aug 2013
1 answer
374 views
Hi – I have a grid where one of the columns is a lookup (dropdown list) – I set the editor and template properties as shown here and everything was working.

However now I am attempting to use requirejs and I receive the following error on the template property when the grid is loading - Uncaught ReferenceError:
getFullName is not defined.


Here is the relevant code:
 
Invitations.htm
<script data-main="/js/invitations" src="/js/lib/require.js" type="text/javascript">
</script>
...
<div id="gridInvitations">
</div>

Invitations.js
require(['/js/common.js'], function (common) {   
    require(['app/mainInvitations'], function(main) {
        /* Must read the query string '?eventId=x' */
        var qryString = location.search;
        var eventId = qryString.substr(qryString.indexOf("=") + 1);       
       main.initGrid(eventId);
    });
});

Common.js
require.config({
    baseUrl: "/js/lib",
    paths: {
        app: '../app',      
        jquery: '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min',
        js: '..',       
       kendo: '../kendo/kendo.web.min'
    },
  shim: {
       kendo: {
      deps: ["jquery"]
        }
   },
    deps: ['js/utils', 'js/json2'],
    callback: function () {
    }
});

MainInvitations.js
define(['app/mainInvitations', "js/utils", "jquery", "kendo"], function (main, utils, $, k) {

    $(document).ready(function () {
    });

    var contactList = [];
    var gridDataSource;

    function initGrid(eventId) {

        $("#gridInvitations").kendoGrid({
            autoBind: false,
            editable: { mode: 'inline' },
            toolbar: [{ name: "create"}],
            columns:
                [
                    { field: 'invitationId', title: 'invitationId', width: "100px", hidden: true },
                    { field: 'eventId', title: 'eventId', hidden: true },
                    { field: "contactId", title: "Contact", width: "225px",
                        editor: contactDropDownEditor,
                        template: "#=getFullName(contactId)#",
                        footerTemplate: "Total:  #=count #"
                    },
                    { field: 'inviteType', title: 'Invite Type' },
                    { field: 'inviteSentDate', title: 'Invitation Sent', format: "{0: yyyy-MM-dd HH:mm:ss}" },
                    { field: 'rsvpStatus', title: 'RSVP', hidden: false },
                    { field: 'rsvpDate', title: 'RSVP Date', format: "{0: yyyy-MM-dd}" },
                    { field: 'rsvpComments', title: 'RSVP Comments' },

                    { command: ["edit", "destroy"], title: "&nbsp;", width: "200px" }
                ],

            dataSource: createGridDataSource(eventId),
            selectable: 'row',
            sortable: true,
            filterable: true
        });


        /* Get list of contacts and assign them to grid column */
        $.ajax({
            url: utils.getBaseServicesUrl() + "/wcfDataServices/contacts.svc/contacts_getList",
            dataType: "json",
            success: function (result) {

                contactList = result.d;
                gridDataSource.fetch();
                console.log(contactList);
            },
            error: function () {
                alert('Error fetching contactList');
            }
        });

    }

    function createGridDataSource(eventId) {

        var dataSource = new kendo.data.DataSource({
            transport: {
                read: function (options) {

                    $.ajax({
                        url: utils.getBaseServicesUrl() + "/wcfDataServices/invitations.svc/tblEvents(" + eventId + ")/tblInvitations",
                        dataType: "json",
                        success: function (result) {
                            options.success(result);
                        }
                    });
                } 

            },
            /*
            parameterMap: function (data, type) {
            return JSON.stringify(data);
            },
            */
            schema: {
                data: "d",
                model: {
                    id: "invitationId",
                    fields: {
                        invitationId: { type: "number", editable: false },
                        eventId: { type: "number", editable: false },
                        contactId: { type: "number" },
                        inviteType: { type: "string" },
                        inviteSentDate: { type: "date" },
                        rsvpStatus: { type: "string" },
                        rsvpDate: { type: "date" },
                        rsvpComments: { type: "string", validation: { required: true} },
                        lastUpdated: { type: "date" },
                        lastUpdatedBy: { type: "string" }
                    }
                }
            },

            aggregate: { field: "contactId", aggregate: "count" }

        });

        gridDataSource = dataSource;
        return gridDataSource;

    }




    function contactDropDownEditor(container, options) {

        $('<input data-bind="value:' + options.field + '"/>')

        .appendTo(container)
        .kendoDropDownList({
            dataTextField: "FullName",
            dataValueField: "contactId",
            dataSource: contactList,
            optionLabel: ""
        });


    }

    
    function getFullName(contactId) {
        for (var idx = 0, length = contactList.length; idx < length; idx++) {
            if (contactList[idx].contactId === contactId) {
                return contactList[idx].FullName;
            }
        }
    }
    
    
    return {

        initGrid: initGrid, 
        getFullName: getFullName
    }

});


It took me a while to finally get the lookup column working in the grid and I'm now stuck on this problem - any suggestions would be greatly appreciated.  As I mentioned, this line is causing the problem: template: "#=getFullName(contactId)#",

Thanks a lot

Brian


 
Alexander Popov
Telerik team
 answered on 22 Aug 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?