Telerik Forums
Kendo UI for jQuery Forum
1 answer
129 views
I need to be able to set the focus to a numerictextbox, then on change to a dropdownlist

Doesn't seem to be working though...

In the master combobox in the change event I'm doing this
$("#quantity").focus();

here's the initialization of the numeric box
var quantityBox = $("#quantity").kendoNumericTextBox({
        min: 1,
        format: "#.00 units",
        change: function(e){
            fromCombo.input.focus();
            fromCombo.open();
        }
    }).data("kendoNumericTextBox");

...and you can see that on it's change I try and set the focus as well
Georgi Krustev
Telerik team
 answered on 13 Dec 2011
1 answer
408 views
Hi,

I would like to have an image to the left of the text in the combo box similar to how I have the button in this image, I am using the combo more like a menu where you can select the 2 items in the list but it does not change what is on the tool bar.

I have tried to do it the same way I implemented the button but no luck.

Any ideas

<button id="moveButton" class="k-button"><img />Move</button>
<button id="viewXML"><img /></button>

#moveButton img, #viewXML img
{
    content: "";
    float: left;
    width: 16px;
    height: 16px;
    margin: 5px 5px 0 0;
    background-image: url('images/SpritesSmall.png');
    background-position: -70px center;
}

$("#viewXML").kendoDropDownList([{ text: "Option 1", value: "1" }, { text: "Option 2", value: "2"}]);
$("#viewXML").data("kendoDropDownList").text("View XML")



Dimo
Telerik team
 answered on 13 Dec 2011
1 answer
496 views
So far these have been FANTASTIC to work with. 

I have two questions.
1) As you can see in the code I currently have 11 panelBars.  Each panel bar is located in its own tab.  When I click on a section it expands and collapses as expected.  But, now I wanted to add in a Toggle to Collapse/Expand all the sections in the current panel.
So the ID of the element I click to do this is id="1-panel" etc.  I can then parse it to figure out which panel I am dealing with.

After that I get lost.  I looked at the example in the download and just can't seem to make it work.  I stepped through the code and there were no errors. 

Can you help point me to what I am doing wrong?

2) As I stated I am working on a dynamic project.  I have a php file where I define my tabs, sections, and controls.  I can build out the system with this one file.   But, the issue I am struggling with is how to dynamically add the script.  I cannot just add it to the html page generated.  WP doesn't like that.  Is it possible to simple call a Jquery function that will initiate the new panel without having to go in and actually add the panel code?

Thanks a million for your help!

/* Initialize panel bars */
 
    $("#panelbar1").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar2").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar3").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar4").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar5").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar6").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar7").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar8").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar9").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar10").kendoPanelBar().data("kendoPanelBar");
    $("#panelbar11").kendoPanelBar().data("kendoPanelBar");
     
    /* expand/collapse panel */
    $(".triggerItem").click(function (e) {
        var target = this;
        var panelbar = '#' + target.element.context.id;
        var item = $( panelbar ).select();
        if (item.hasClass("k-state-active")) {
            $( panelBar ).collapse(item);
        } else {
            $( panelBar ).expand(item);
        }
    });
     // Collapse all the sections in the panel
    $('.p-collapse').click(function (e) {
        var elementId = this.id;
        var target = '#panelbar' + elementId.substring(0, elementId.length - 6) ;
        var panelBar = $( target ), clone = $( target ).clone(true);
         
        panelBar.data( "kendoPanelBar" ).collapse( target + ' k-link' );
        panelBar.replaceWith( clone );
        $(target).kendoPanelBar();
    });
Kamen Bundev
Telerik team
 answered on 13 Dec 2011
1 answer
92 views
Are there examples that are incremental in complexity or only require minimal CSS to work?

Thanks,

Brian

The Basic Usage example for autocomplete has attributes that are not supported by any of the standard browsers.
( http://www.w3schools.com/html5/att_style_scoped.asp )

        <style scoped="scoped">
                .info {
                    display: block;
                    line-height: 22px;
                    padding: 0 5px 5px 0;
					color: #36558e;
                }
				
				#shipping {
					width: 482px;
					height: 152px;
					padding: 110px 0 0 30px;
					background: url('../content/autocomplete/shipping.png') transparent no-repeat 0 0;
					margin: 30px auto;
 				}

                .k-autocomplete
                {
                    width: 250px;
					vertical-align: middle;
                }

                .hint {
                    line-height: 22px;
                    color: #aaa;
                    font-style: italic;
					font-size: .9em;
					color: #7496d4;
                }
            </style>
Kamen Bundev
Telerik team
 answered on 13 Dec 2011
3 answers
155 views
Here is my test HTML page (only relevant to the problem):
<ul id="books"></ul>
 
            <script id="template" type="text/x-kendo-template">
                <li class="book">
                    <h3>#= title #</h3>
                    by #= author #
                </li>
            </script>
 
            <script>
                $(document).ready(function() {
                    function onChage() {
                        $("#books").html(kendo.render(template, this.view()));
                    }
 
                    // create a template using the above definition
                    var template = kendo.template($("#template").html());
 
                    var dataSource = new kendo.data.DataSource({
                        transport: {
                            read: "filters.xml"
                        },
                        schema: {
                            // specify the the schema is XML
                            type: "xml",
                            data: "/Filters/Filter",
                            model: {
                                fields: {
                                    title: "title/text()",
                                    author: "@Id",
                                    url: "info/text()"
                                }
                            }
                        },
                        change: onChage
                    });
 
                    dataSource.read();
                });
            </script>

and here is my XML file:
<?xml version="1.0"?>
-<Filters> -<Filter Id="drwho"> <Collection>drwho</Collection> <Title>Favourite Doctor</Title> <Info>link_to_popup_info.html</Info> <Image>drwho.png</Image> </Filter> -<Filter Id="poo"> <Collection>poop</Collection> <Title>smell that?</Title> <Info>link_to_popup_info.html</Info> <Image>poop.png</Image> </Filter> </Filters>

It doesn't work. I've also noticed if I overwrite the books.xml file in the sample line by line it will work. Other than that (which is stupid) I have no idea why the code refuses to run. The code is from the xml-data.html file.

Any ideas?
Petyo
Telerik team
 answered on 13 Dec 2011
1 answer
291 views
Can we get a list of all the field types available in schema definitions of models?
Rosen
Telerik team
 answered on 13 Dec 2011
1 answer
73 views
I tried to see the demo on a WP7 phone and it said to use a Webkit browser. This is disappointing. Why? Is every user action gesture based only? The controls must support regular non gesture user input. WP7.5 uses IE9 which supports HTML5 and a lot of the CSS3 stuff. So what's the issue?
Kamen Bundev
Telerik team
 answered on 13 Dec 2011
2 answers
125 views
Since there is no dedicated forum to the Validator, I'll post it here.

I have a form with a Validator applied to a text input. Works well except for submitting the form. According to the docos "Note that if a HTML form element is set as validation container, the form submits will be automatically prevented if validation fails."

This is not the case as my form submits anyway. I'm checking for false on the button click at the moment, but it doesn't work for anything. I would like submisson of forms to be disabled as per the documentation.

Any ideas?

@<div id="searchform">
    <form method="get" action="@Href("~/Collection/Search")" class="search">
    <ul>
        <li>
            <input type="text" name="q" value="@q" class="k-textbox" required />
        </li>
        <li>
            <button class="k-button" id="search">Search</button>
        </li>
    </ul>
    </form>
    <div class="status">
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            var validator = $("#searchform").kendoValidator({
                rules: {
                    custom: function (input) {
                        return input.val().length > 3;
                    }
                },
                messages: {
                    custom: "You need 3 or more characters",
                    required: "Oops, you forgot me!",
                    email: function (input) {
                        return getMessage(input);
                    }
                }
            }).data("kendoValidator");
            $("#search").click(function () {
                if (validator.validate() == false) {
 
                }
            });
        });
    </script>
</div>
Gabriel
Top achievements
Rank 1
 answered on 13 Dec 2011
0 answers
99 views
The api.html sample code was confusing because ID's of the fields were named generically ("set", "get", etc.).

Sample code, imo should have clearly named variables and components.
Developers should be able to copy the sample and just rename the components to fit their own application.
If a field is named "value" it slows reuse because the developer has to think about all the other instances of "value" in the HTML/Javascript.

Here's my refined version of api.html.  It can use further refinements but it demonstrates the principle of appropriate object name scoping.

<!doctype html>
<html>
    <head>
        <title>API</title>
        <link href="../../shared/styles/examples.css" rel="stylesheet"/>
        <link href="../../shared/styles/examples-offline.css" rel="stylesheet"/>
        <link href="../../../styles/kendo.common.min.css" rel="stylesheet"/>
        <link href="../../../styles/kendo.default.min.css" rel="stylesheet"/>
        <script src="../../../js/jquery.min.js"></script>
        <script src="../../../js/kendo.core.min.js"></script>
        <script src="../../../js/kendo.popup.min.js"></script>
        <script src="../../../js/kendo.data.min.js"></script>
        <script src="../../../js/kendo.list.min.js"></script>
        <script src="../../../js/kendo.autocomplete.min.js"></script>
        
            <style >
                #movieSelectionFieldId {
                    margin-right: 50px;
                }

                #example .code-sample {
                    margin-top: 0;
                    width: 300px;
                }
            </style>
        
    </head>
    <body>
        <a href="../index.html">Back</a>
        <div class="description">API</div>
        <div id="example" class="k-content">

            <div class="code-sample output">
                <h4 class="code-title">Begin entering name of a movie title:</h4>
                <div class="prettyprint">
                    <input id="movieSelectionFieldId" />
                </div>
            </div>

            <script>
                $(document).ready(function() {
                    var moviesAvailableArray = [
                        "12 Angry Men",
                        "Il buono, il brutto, il cattivo.",
                        "Inception",
                        "One Flew Over the Cuckoo's Nest",
                        "Pulp Fiction",
                        "Schindler's List",
                        "The Dark Knight",
                        "The Godfather",
                        "The Godfather: Part II",
                        "The Shawshank Redemption"
                    ];

                    $("#movieSelectionFieldId").kendoAutoComplete(moviesAvailableArray);

                    var moviePickedValueAutoComp = $("#movieSelectionFieldId").data("kendoAutoComplete"),
                        setValue = function(e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode)
                                moviePickedValueAutoComp.value($("#setMovieFieldValueInputId").val());
                        },
                        setSearch = function(e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode)
                                moviePickedValueAutoComp.search($("#searchHelperFieldId").val());
                        };

                    $("#setMovieFieldButtonId").click(setValue);
                    $("#setMovieFieldValueInputId").keypress(setValue);
                    $("#searchHelperButtonId").click(setSearch);
                    $("#searchHelperFieldId").keypress(setSearch);

                    $("#getMovieFieldValueButtonId").click(function() {
                        alert(moviePickedValueAutoComp.value());
                    });
                });
           </script>

           <div class="configuration">
                <span class="configHead">Configuration</span>
                <span class="configTitle">API Functions</span>
                <ul class="options">
                    <li>
                        <input id="setMovieFieldValueInputId" type="text" />
                        <button id="setMovieFieldButtonId" class="k-button">Set value</button>
                    </li>
                    <li>
                        <button id="getMovieFieldValueButtonId" class="k-button">Get value</button>
                    </li>
                    <li>
                        <input id="searchHelperFieldId" value="The" />
                        <button id="searchHelperButtonId" class="k-button">Find starting with</button>
                    </li>
                </ul>
           </div>

            <div class="code-sample">
                <h4 class="code-title">Initialization Data</h4>
                <pre class="prettyprint lang-js">
var moviesAvailableArray = [
    "12 Angry Men",
    "Il buono, il brutto, il cattivo.",
    "Inception",
    "One Flew Over the Cuckoo's Nest",
    "Pulp Fiction",
    "Schindler's List",
    "The Dark Knight",
    "The Godfather",
    "The Godfather: Part II",
    "The Shawshank Redemption"
];</pre>
            </div>

        </div>
    </body>
</html>
bri norq
Top achievements
Rank 1
 asked on 12 Dec 2011
1 answer
88 views
I have created a simple test from your examples

<!DOCTYPE html>
<head>
    <title></title>
 
    <link href="../Styles/kendo.common.css" rel="Stylesheet" />
    <link href="../Styles/kendo.default.css" rel="Stylesheet" />
    <script src="../Scripts/kendo/jquery.min.js"></script>
    <script src="../Scripts/kendo/kendo.core.js"></script>
    <script src="../Scripts/kendo/kendo.data.js"></script>
    <script src="../Scripts/kendo/kendo.chart.js"></script>
</head>
<body>
           <div id="example" class="k-content">
 
           <div>
                <div id="chart"></div>
            </div>
            <script type="text/javascript">
                function createChart() {
                    $("#chart").kendoChart({
                        theme: $(document).data("kendoSkin") || "default",
                        dataSource: {
                            transport: {
                                read: {
                                    url: "test.json",
                                    dataType: "json"
                                }
                            },
                            sort: {
                                field: "Program",
                                dir: "asc"
                            }
                        },
                        title: {
                            text: "Signup Count"
                        },
                        legend: {
                            position: "bottom"
                        },
                        seriesDefaults: {
                            type: "pie",
                            labels: {
                                template: "${ value } - ${ category }",
                                visible: true
                            }
                        },
                        series: [{
                            field: "SignupCount",
                            categoryField: "Program"
                        }],
                        tooltip: {
                            visible: false
                        }
                    });
                }
 
                $(document).ready(function () {
                    setTimeout(function () {
                        createChart();
 
                        // Initialize the chart with a delay to make sure
                        // the initial animation is visible
                    }, 400);
 
                    $(document).bind("kendo:skinChange", function (e) {
                        createChart();
                    });
                });
            </script>
        </div>
 
</body>
</html>

test.json is a file that contains

[{"AgentsNames":["person 1"],"Program":"GOLD","SignupCount":1},{"AgentsNames":["person 2","person 3"],"Program":"No Program","SignupCount":2}]

that works perfectly

but when I change the url to "datastream.aspx?r=SIGNUPCOUNT" it doesnt work. This page responds with that JSON string

MemoryStream stream = GPCO.JSON.Serialize(stats.Programs);
string response = GPCO.Convert.BytesToUTF8(stream.GetBuffer());
Response.Clear();
Response.ContentType = "application/json";
Response.Write(response);

I've confirmed that it writes 

[{"AgentsNames":["person 1"],"Program":"GOLD","SignupCount":1},{"AgentsNames":["person 2","person 3"],"Program":"No Program","SignupCount":2}]

that is also the source in the browser when I call the page directly. I've tried various parameters in the transport type: "GET" but nothing seems to work. 



David
Top achievements
Rank 1
 answered on 12 Dec 2011
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
Dialog
Chat
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
TextArea
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
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
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?