Telerik Forums
Kendo UI for jQuery Forum
0 answers
171 views
I have a Kendo Chart defined on my cshtml page as below:

@(Html.Kendo().Chart<MyModel>()
        .Name("chart")
        .Title("")
        .Legend(legend => legend
            .Visible(false)
        )
        .Series(series =>
         {
                    series.Scatter(model => model.X, model => model.Y);
                    series.Scatter(model => model.X, model => model.Y);
        })
        )
        
I need to set the data of each of these series using a JQuery call. 


 function GetChartData(ex,ten) {
            var str = "{'arg': '" + ex + "', 'arg2': '" + ten ' }";
            $.ajax({
                type: 'POST',
                url: '/Controller/CreateChartData',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                data: str ,
                success: function (data) {
                
                    var grid = $("#chart").data("kendoChart");
                    grid.dataSource.data(data.ChartData);
                    grid.refresh();
                    
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.status);
                    alert(thrownError);
                }
            });

The above will set the 1st series data, but I need to be able to set the second series as well. I have all of the data returning correctly from the database, but no way of setting both series data.

I have tried the following which rendered nothing on the chart:

 function GetChartData(ex,ten) {
            var str = "{'arg': '" + ex + "', 'arg2': '" + ten ' }";
            $.ajax({
                type: 'POST',
                url: '/Controller/CreateChartData',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                data: str ,
                success: function (data) {
                
                    var grid = $("#chart").data("kendoChart");
    grid.options.series[0].data = data.ChartData;
     grid.options.series[1].data = data.ChartDataSeries2; 

                    grid.refresh();
                    
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.status);
                    alert(thrownError);
                }
            });

 
                  
Ben
Top achievements
Rank 1
 asked on 19 Sep 2012
1 answer
131 views
I do not know if this is possible, or if this can be added to a new version of the DataViz toolkit.

I would like to be able to add an image, or icon inside a Bubble Chart so you know exactly what it is with just looking at it

Thanks
Iliana Dyankova
Telerik team
 answered on 19 Sep 2012
0 answers
112 views
How to add 'Menu' next to title of 'Window' Component or on hover of custiom icon how to populate a menu with 4 items

Thanks,
Chetan
Chetan
Top achievements
Rank 1
 asked on 19 Sep 2012
1 answer
894 views
The following code is dataSource for validating values via a controller method:

            SampleDataSource: new kendo.data.DataSource({
                transport: {
                    read: {
                        url:  "Sample/ValidateSampleCodes",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        type: "POST"
                    },
                    parameterMap: function (options, operation) {
                        return JSON.stringify({ SampleCode: options.SampleCode });
                    },
                },
                schema: {
                    model: {
                        id: "Id"
                    },
                    parse: function (data) {
                        viewModel.set("SampleCodesFromDB",data[0]);
                        return data;
                    }
                }
            }),

The following code is the grid in which i need to validate values entered, instantly and display an in-line validation message. I am using the custom validator as shown below...

                $("#Sample-code-grid").kendoGrid({
                    dataSource: { 
                        data: viewModel.SampleCodes,
                        schema: {
                            model: {
                                id:"Id",
                                fields : {
                                    SampleCode : { editable: true, validation: { custom: function (input) {
                                            var isValid = true;
                                            if (input.attr("name") == "SampleCode") {
                                                
                                                // Reading the below datasource to check if value already exists in DB
                                                
                                                viewModel.SampleDataSource.read({ SampleCode: input.val() });


                                                // When debugging, i find that the above read method call is skipped until 
                                                // custom validator function is fully executed...


                                                var isValidMessage = viewModel.get("SampleCodesFromDB");
                                                if(isValidMessage == "Code Exists")
                                                    isValid = false;
                                                if(!isValid)
                                                    input.attr("data-custom-msg", "Sample Code already added.");
                                            }
                                            return isValid;
                                        }
                                        }
                                    }
                                }
                            }
                        },
                        change: function(e) {
                            if(e.action == "itemchange" || "remove") {debugger;
                                viewModel.SampleCodes = [];
                                $.each(e.sender.data(), function(inx, val) {
                                    viewModel.SampleCodes.push({ SampleCode : val.SampleCode });
                                });
                            }
                        }
                    },
                    selectable: true,
                    editable: "inline",
                    toolbar: [{ name: "create" , text : "Add Sample Code" }],
                    columns: [
                        { field: "SampleCode", title: "Sample Codes" },
                        { command: ["edit", "destroy"], title: "&nbsp;", width: "210px" }
                    ]
                });

I have added some comments inside the code so that you get some idea about my problem. I just need to know how to approach validation for duplicates using the custom validator that calls a dataSource for the same purpose.

Any help will be greatly appreciated.
Alex
Top achievements
Rank 1
 answered on 19 Sep 2012
3 answers
355 views
I have a grid whose datasource has a filter set on a foreign key. It's a remote datasource to a SharePoint 2010 list odata service. The create command in the grid's toolbar does not do anything. As soon as I remove the filter from the datasource, the create command works again. How can I get the create command to work with the filter set? I assume I need to find a way to set the foreign key on the newly created object to the same value as the filter and only then will the new object show up in the grid.
Remco
Top achievements
Rank 1
 answered on 19 Sep 2012
1 answer
177 views
I can find plot bands, but I cannot find how to plot lines.

I can also add a plotband to the valueAxis like this: 
valueAxis: {
       plotBands: [{
             from: 0.4,
             to: 0.4001,                               
             color: "red"
         }]
 }
However this requires me to add a from and a to. This doesn't exist. i just want a simple line plotted at a particular value.

Can anyone help? I have a link to Highcharts where they show an example of how they do it (addPlotLine): http://www.highcharts.com/studies/dynamic.htm 
Iliana Dyankova
Telerik team
 answered on 19 Sep 2012
0 answers
132 views
Hi,

We have a web user control with an input and a HTML select:

<input id="createSubTenant_Name" type="text" data-bind="value: SubTenantName" />
<select id="CreateSubTenant_Parent" data-bind="value: TenantId">
    <option></option>
</select>

The options will be added by JavaScript (text and value).
The binding with kendo.observable and kendo.bind in JavaScript:

var viewModel = kendo.observable({
    SubTenantId: "",
    SubTenantName: "",
    TenantId: ""
});

kendo.bind(window, viewModel);

The user has to fill the input box and select an entry. In the submit method, we will get the view model:

viewModel.toJSON();

And here is the problem. By default the first entry of the select is selected. If the user does not select another option of the select, the “TenantId” of the viewModel will be null. If the user selects another option of the select, the “TenantId” will be set in the viewModel perfectly.
Our actual work around:

var sel = document.getElementById('CreateSubTenant_Parent');
viewModel.TenantId = sel.options[sel.selectedIndex].value;

Almost the same problem appears with an input box. In another web user control, the user only has to type a name in input box. By typing enter the submit method will be called. In this case the cursor does not leave the input box and the same problem appears.

Is it a general problem? Can someone help?

Thanks.
Patrick
Top achievements
Rank 1
 asked on 19 Sep 2012
0 answers
163 views
my command don't run 
.Create(c=>c.Action("CreateNewEmployee", "HRM")) 
.Update(update => update.Action("Employee_Update", "HRM"))
        .Destroy(update => update.Action("Employee_Destroy", "HRM")) 
in controller but can run
.Read(read => read.Action("Employee_Read", "HRM")) 

@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.EmpID).Visible(false);
        columns.Bound(p => p.Role);
        columns.Bound(p => p.Branch);
        columns.Bound(p => p.Name);
        columns.Bound(p => p.Address);
        columns.Bound(p => p.Username);
        columns.Bound(p => p.Status);
        columns.Command(c =>
        {
            c.Edit();
            c.Destroy();
        }).Width(250);
    })
    .Editable(editable =>
    {
        editable.Mode(GridEditMode.PopUp);
        editable.TemplateName("EmployeeEditor");
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .ToolBar(toolbar =>
    {
        toolbar.Create();
        })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(10)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(p => p.EmpID))
        .Create(c=>c.Action("CreateNewEmployee", "HRM"))
        .Read(read => read.Action("Employee_Read", "HRM"))
        .Update(update => update.Action("Employee_Update", "HRM"))
        .Destroy(update => update.Action("Employee_Destroy", "HRM"))
    )
    .HtmlAttributes(new { style = "height:550px" })
)

Dechochai
Top achievements
Rank 1
 asked on 19 Sep 2012
1 answer
121 views
I have a column in my grid that I do not wish the user to be able to hide using the column menu.

How do I prevent the column from appearing in the grid's column show/hide menu?

Thanks,

Doug
Nikolay Rusev
Telerik team
 answered on 19 Sep 2012
3 answers
149 views
Hi
I m using Kendo UI control. I found some issues using them, so need clarification.

1. When dropdown is used inside Kendo Window then it is hidden. Please see below code
 @(Html.Kendo().Window()
     .Name("widget")
            .Title("widget Menu")
    .Content(@<text>
    @model List<Dashboard.Models.WidgetData>
    <div id="widgetMenuselection">
       @* @Html.Action("WidgetType", "WidgetType")*@
               @(Html.Kendo().DropDownList()
                .Name("Text")
        .DataTextField("Text")
        .DataValueField("Value")
        .AutoBind(true)
        .BindTo(new List<SelectListItem>() {
                new SelectListItem() {Text = "Filter/Menu",Value = "-1"},
                new SelectListItem() {Text = "Graph",Value = "1"},
                new SelectListItem() {Text = "Tabular",Value = "2"}
                })
        .Value("-1")
        .SelectedIndex(-1)
        .Events(e => e.Change("wdgtMenudrplist_change"))
    )
 </text>)
    )
2. I donot find any way to attach checkbox to tree view in Kendo. I m using Razor MVC 4, and my table structure has a seatinggroup table and seating table distinctly with seating group has many seats under it. So can i provide tree view individual values of group and seats.
Daniel
Telerik team
 answered on 19 Sep 2012
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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?