Telerik Forums
Kendo UI for jQuery Forum
1 answer
169 views
I wanted some persistence with Cascading Combo Boxes when using an AJAX data binding.
The solution also needed to be able to pass a 'selected value from the controller handling the data retrieval.

This is what i came up with, hopefully this is useful to someone else aswell
cshtml
Only thing of note here is the jQuery DataBound event that will handle getting the selected value and setting it
<label for="Client">Client</label>
            @(Html.Kendo().ComboBox()
                .Name("Client")
                .Placeholder("Select Client...")
                .DataTextField("ClientName")
                .DataValueField("ClientID")
                .Events(e => e.DataBound("onDataBoundClient"))
                .DataSource(source =>
                    {
                        source.Read(read =>
                            {
                                read.Action("GetClientsCombo", "Tools");
                            });
                    })
                )
            <label for="Package">Package</label>
            @(Html.Kendo().ComboBox()
                .Name("Package")
                .Placeholder("Select Package...")
                .DataTextField("PackageName")
                .DataValueField("PackageID")
                .Events(e => e.DataBound("onDataBoundPackage"))
                .DataSource(source =>
                    {
                        source.Read(read =>
                            {
                                read.Action("GetPackagesCombo", "Tools")
                                    .Data("filterPackages");
                            })
                            .ServerFiltering(true);
                    })
                .Enable(false)
                .AutoBind(false)
                .CascadeFrom("Client")
              )
ToolsController.cs
Additional bool coloumn in select that will return true only if selected Client/Package Id is = to session var
public JsonResult GetClientsCombo()
        {
                int selectedClientId = Session["selectedClientId"];
                var query = //Linq Query to get results
                            select new
                                {
                                    ClientID = LinqClientIdColumn,
                                    ClientName =  LinqClientNameColumn,
                                    Selected = LinqClientIdColumn == selectedClientId
                                };
                return Json(query, JsonRequestBehavior.AllowGet);
        }
 
        public JsonResult GetPackagesCombo(int clients, string packageFilter)
        {
                int selectedPackageId = Session["selectedPackageId"];
                var query = //Linq Query to get results
                            select new
                            {
                                PackageID = LinqPackageIdColumn,
                                PackageName = LinqPackageNameColumn,
                                Selected = LinqPackageIdColumn == selectedPackageId
                            };
           
                return Json(query, JsonRequestBehavior.AllowGet);
 
        }
JS ondatabound events
These functions are called when data is bound to the combo boxes. They get the data object from the AJAX call and return an array of objects, using jQuery Grep, where selected is === true then use the first object found to populate select a default value from the combo.

I initially tried compacting these two functions into one abstracted function and passing the jquery selector reference and selectedObject[].property as variables in the event handler. Evidently passing variable eg (.Events(e => e.DataBound("onDataBoundPackage('var1', 'var2')")) in the databound event handler breaks the databinding.
function onDataBoundClient() {
                    var DataObject = $("#Client").data("kendoComboBox").dataSource.data();
                    var selectedObject = $.grep(DataObject, function (obj) {
                        return obj.Selected === true;
                    });
                    $("#Client").data('kendoComboBox').value(selectedObject[0].ClientID);
                };
                function onDataBoundPackage() {
                    var DataObject = $("#Package").data("kendoComboBox").dataSource.data();
                    var selectedObject = $.grep(DataObject, function (obj) {
                        return obj.Selected === true;
                    });
                    $("#Package").data('kendoComboBox').value(selectedObject[0].PackageID);
                };

Jayesh Goyani
Top achievements
Rank 2
 answered on 11 Jun 2013
1 answer
53 views
Hi

How can I search only e.g. "web/splitter" subcategory in Kendo forums?
(secondly there seems to be no general category to post this kind of question.. :)

Thanks
 Raido
Iva
Telerik team
 answered on 11 Jun 2013
1 answer
223 views
Is it possible to call a viewmodel method from within the markup for a viewmodel?
Alexander Valchev
Telerik team
 answered on 11 Jun 2013
3 answers
140 views
I have two JS fiddles:

http://jsfiddle.net/fL28r/1/   - Using 2011.3.1129
http://jsfiddle.net/fL28r/2/   - Using 2012.1.515

First Fiddle:
If you try to drag and drop from the Grid to the treeView, you will see that the cursor offset looks valid and the row is not below the cursor.

Second Fiddle:
If you try to drag and drop from the GridView to the treeView, you will see that the hint gets displayed UNDERNEATH the cursor. This is causing me problems as it seems to think that the dropTarget is the hint object instead of a treeNode.

I have also tried this in the latest commercial build (v2012.1.601 [using my commercial account]) and am able to reproduce the issue. Would I be able to get help in resolving this issue?
Stefano
Top achievements
Rank 1
 answered on 11 Jun 2013
1 answer
205 views
I am trying to upload a file via a service that implements OData. I cannot seem to set any additional headers on the upload control. I need to set a custom slug header.

Here is the error I am receiving. Despite what it says the header format is below the error.

Invalid slug header for attachment. Slug headers must be of the form "EntitySet,ItemId,Name".

Here is how the headers should look:
    Slug: MyListTitle|1|mydocument.docx
T. Tsonev
Telerik team
 answered on 11 Jun 2013
1 answer
122 views
We want to reset the scroller in the data-after-show function of a view. It works well everywhere except after a getting to a page using the back-button - as it seems that when we get there the app view id is still the one of the page where the button was clicked, and not the page to which we return and where the event is bound.

Is there a way around this?
Petyo
Telerik team
 answered on 11 Jun 2013
1 answer
185 views
I have grid which editable in cell
I have some custom fields which has combobox when i edit that perticular field.
When i sort grid on this feild it does not get sorted.
Similar for filter, when I use filter on these custom fields, It gives me errors.
How can I make grid sortable and filterable that has custom fields as column?
Alexander Valchev
Telerik team
 answered on 11 Jun 2013
1 answer
171 views
Hi:

I'm looking for a way to hide (don't display) the vertical scrollbar from the right side but still be able to scroll. How can I accomplish that? Is that something that can be managed with CSS or with JavaScript?
Petyo
Telerik team
 answered on 11 Jun 2013
2 answers
85 views
Hello.
I'm doing a dropdownlist with the MVC helper like this, but the option with empty text is not showing, a red line is showing instead.

How can I show the empty option so that users can select, yes, no, or empty ( show all ) without having to set a text or value for that option?
@(Html.Kendo().DropDownList()
                   .Name("isPublic")
                   .Items(items =>
                       {
                           items.Add().Text("").Value("");
                           items.Add().Text("Yes").Value("true");
                           items.Add().Text("No").Value("false");
                       }
                   )
               )


Thanks in advance.
Sergi
Top achievements
Rank 1
 answered on 11 Jun 2013
10 answers
1.1K+ views
Hey All,

I have been working with the column charts, and finally figured out how to stack the bars in the chart with the help of this article.
http://www.kendoui.com/forums/dataviz/chart/stack-multiple-series.aspx 

There's a problem though. The largest value bars are going 'over the top' of the chart (they are exceeding the max y-axis value).
The funny thing is that it seems like the value has to be an ODD number to get it to go over the top axis.

Below is all the code to replicate. Attached is a screenshot of what I am seeing.

Is this a bug? Am I doing something wrong?

This happens with both default and black Kendo Skins.
Tested on Chrome 18.0.1025.162, Firefox 8.0.1, and IE9.
I am using Kendo UI Complete v2012.1.322

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/file/Kendo/kendo.common.min.css"/>
    <link rel="stylesheet" href="/file/Kendo/kendo.black.min.css"/>
</head>
<body>
<script type="text/javascript" src="/file/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/file/Kendo/kendo.all.min.js"></script>
<script type="text/javascript">
    var data = [{"Period":"1-3","Comp1":1,"Comp2":2,"Comp3":4,"Comp4":0},{"Period":"3-5","Comp1":2,"Comp2":5,"Comp3":0,"Comp4":2},{"Period":"5-7","Comp1":3,"Comp2":1,"Comp3":4,"Comp4":2},{"Period":"7-9","Comp1":2,"Comp2":3,"Comp3":5,"Comp4":1},{"Period":"9+","Comp1":3,"Comp2":1,"Comp3":2,"Comp4":2}];

    function createCharts () {
        $("#chartIVPayers").kendoChart({
            theme: $(document).data("kendoSkin") || "black",
            title: {
                text: "Comps"
            },
            dataSource:  data,
            series: [{
                type: "column",
                field: "Comp1",
                name: "Comp1",
                stack: "Comp2,Comp3,Comp4"             
            },{
                type: "column",
                field: "Comp2",
                name: "Comp2"
            },{
                type: "column",
                field: "Comp3",
                name: "Comp3"            
            },{
                type: "column",
                field: "Comp4",
                name: "Comp4"            
            }],
            categoryAxis: {
                field: "Period"
            }
        });
    }
    
    setTimeout(function() {
            createCharts(); 
        }, 
    400);

</script>
    <div id="chartIVPayers"></div>
</body>
</html>
Iliana Dyankova
Telerik team
 answered on 11 Jun 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
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?