Telerik Forums
Kendo UI for jQuery Forum
3 answers
273 views
Hey,

Sorry for another dropdown post that seems so much like the others, but I have spent hours trying to get this to work and for some reason it won't. All I am trying to do is have a dropdown for State and City. On open the State list will be retrieved. Then when a State is selected, the City list will be retrieved. 

What I am seeing:
When I select the State, the City request will be made, it returns, and the City data source IS populated. But when I click on the City drop down list, it is not responsive. I try and click on it, but it doesn't respond at all!

I've been screwing around with the code so much that I'm probably missing something, but any help at all would be greatly appreciated.

I also just downloaded the newest Kendo code.
Kendo: 2012.1.322
jquery-1.7.1.min.js
Chrome: 17.0.963.83

var dsStates,
        dsCities
        ;
 
    $("#app").show();
 
    getStates();
     
    // wire up list view to available dbconn objects
    function getStates() {
        dsStates = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/infoburst/rest/exec/xdcqry/165?q=States",
                    data: {
                        json: "true"
                    },
                    beforeSend: function(req) {
                        // use IBE SessionManager "auth"
                        req.setRequestHeader('Authorization', sm.auth());
                    }
                }
            },
            error: function(e) {
                log("getStates error : " + e);
            }
        });
        dsStates.read();
    }
 
    function getCities(state) {
        dsCities = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/infoburst/rest/exec/xdcqry/165?q=Cities&State=" + "Arizona",//state,
                    data: {
                        json: "true"
                    },
                    beforeSend: function(req) {
                        // use IBE SessionManager "auth"
                        req.setRequestHeader('Authorization', sm.auth());
                    }
                }
            },
            change: function(e) {
                log("get cities info OK");
            },
            error: function(e) {
                log("getCities error : " + e);
            }
        });
        dsCities.read();
    }
 
    $("#states").kendoDropDownList({
        optionLabel: "Select State...",
        dataTextField: "State",
        dataValueField: "State",
        dataSource: dsStates,
        change: function() {
            var value = this.value();
 
            if (value) {
                getCities(value);
                $("#cities").data("kendoDropDownList").enable();
            } else {
                $("#cities").data("kendoDropDownList").enable(false);
            }
        }
    });
 
     $("#cities").kendoDropDownList({
        autoBind: false,
        optionLabel: "Select City...",
        dataTextField: "City",
        dataValueField: "City",
        dataSource: dsCities,
        change: function() {
            var value = this.value();
        },
        error: function(e) {
            log("getCities error : " + e);
        }
    });
Karel
Top achievements
Rank 1
 answered on 08 Oct 2012
6 answers
760 views
Hi,

I found two issues when set a grid in popup edit mode.

1- When inserting, updating or deleting an item, the DataSourceRequest parameter doesn't have any of the filters that the grid have before the operation, and then the results aren't filtered. I checked the http post request, and the filter, sort and group are empty.

Here's the controller:
[AcceptVerbs(HttpVerbs.Post)]
        public virtual JsonResult Insert([DataSourceRequestDataSourceRequest request)
        {
            var item = repository.CreateNew();
            try
            {
                UpdateModel(item);
                repository.Add(item);
                unitOfWork.SaveChanges();
            }
            catch (Exception err)
            {
                ...
            }
            return
                Json(repository.GetAll().ToDataSourceResult(request));
        }

2- I've a custom editor template with a kendo dropdownlist, and when I insert a new item, the field come with '0' value, instead of the default '1'. To get this to work, I've to always select an item of the dropdownlist.

Here's the dropdownlist in the editor template:
@(Html.Kendo()
                  .DropDownListFor(c => c.ID_COIN)
                  .BindTo(new SelectList((IEnumerable)ViewData["Coins"], "ID""DESCRIPCTION", 1)))

Eduardo
Daniel
Telerik team
 answered on 08 Oct 2012
4 answers
196 views
Hi Everyone,

I just started using Kendo, and got a Grid and Menu set up OK, but when I try to use the ListView, I get the following error:

Object [object Object] has no method 'kendoListView'

The error occurs when the .js is first executing, so I'm not really doing anything yet, so I'm confused as to why this might be occuring.
Maybe there is something wrong in the build I have??
I'm new to this, so I'm not sure what else would be helpful to provide.
Thanks!

Code:
$("#listView").kendoListView({
 template: "<li>${FirstName}</li>",
 dataSource: {
 data: [
 {
 FirstName: "Joe",
 LastName: "Smith"
 },
 {
 FirstName: "Jane",
 LastName: "Smith"
 }]
 }
});

Trace:
Uncaught TypeError: Object [object Object] has no method 'kendoListView'
beginApp             app.js:69
$.ajax.success                                       IBE.js:170
jQuery.Callbacks.fire jquery.js:1049
jQuery.Callbacks.self.fireWith jquery.js:1167
done jquery.js:7408
jQuery.ajaxTransport.send.callback jquery.js:8192

OS: Windows 7
Browser: Chrome 17.0.963.78 m
Kendo UI v2011.3.1129 
jQuery JavaScript Library v1.7.1 
Dathan
Top achievements
Rank 1
 answered on 08 Oct 2012
3 answers
183 views
There is sometimes a problem getting Jquery to work with DOM elements that are created from a Kendo template, The following jsfiddle example illustrates my problem: http://jsfiddle.net/billmcknight/G2Xr2/   I can get Jquery to find and fill a textbox when the dom is not created thru a Kendo template but not when it is.  By all rights the Jquery function should work the same way, one would think, but when  jquery looks here for a template-based input, it can't find it and update it.   There are probably ViewModel ways to do this, but I am wondering what is the right way to make Jquery behave correctly?
Brad
Top achievements
Rank 1
 answered on 08 Oct 2012
0 answers
107 views
when i used grid.dataSource.transport.options.read.url, its hitting server and also if i use grid.dataSource.page(1), its hitting server again.
Please give me solution.  i have pasted my code as follow
  function  showJobExecTable(jobId) {

                    var grid=$("#jobexecgrid").data('kendoGrid');
                    if(grid!=undefined) {
                        grid.dataSource.transport.options.read.url =contextPath + "/ajax/jobExecs.htm?jobId="+jobId.trim();
                         grid.dataSource.page(1);
                       grid.dataSource.read();
                        grid.refresh();
                  
                    }
                  
     
                }
Vijay
Top achievements
Rank 1
 asked on 08 Oct 2012
1 answer
228 views
I would like the Bank Name within my Grid to link to the Details page based on the BankID, but I get a Compilation Error on columns.Template(@<text>:
CS1646: Keyword, identifier, or string expected after verbatim specifier: @

My .cshtml code is as follows:

@model IEnumerable<PosPayAndBankRec.Domain.Models.ORTBank>
@using Kendo.Mvc.UI.Fluent

@functions {

    private void BankGridCommandDef(GridColumnFactory<PosPayAndBankRec.Models.BankListItem> columns)
 {
  columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
        columns.Bound(p => p.BankID).Hidden();
        columns.Bound(p => p.BankName);
        columns.Bound(p => p.BankName);
        columns.Template(@<text>
                              @(Html.ActionLink("Edit", "Details", "Account", new {id = @item.BankID}))
                          </text>);
    }

    private void BankGridDataSource(DataSourceBuilder<PosPayAndBankRec.Models.BankListItem> dataSource)
 {
        dataSource.Ajax()
            .Model(AjaxBankDataSourceBuilder)
            .Sort(sort => sort.Add(p => p.BankName))
            .ServerOperation(true)
            .Create(create => create.Action("Create", "Bank"))
            .Read(read => read.Action("Read", "Bank"))
            .Update(update => update.Action("Update", "Bank"))
            .Destroy(destroy => destroy.Action("Delete", "Bank"));
            //.Events(e => e.Error("error"));
 }

    private void AjaxBankDataSourceBuilder(DataSourceModelDescriptorFactory<PosPayAndBankRec.Models.BankListItem> model)
    {
        model.Id(p => p.BankID);
        model.Field(p => p.BankName);
    }

    private void BankGridToolBarDef(GridToolBarCommandFactory<PosPayAndBankRec.Models.BankListItem> toolbar)
    {
        toolbar.Create().Text("New Bank");
    }
}

@{ ViewBag.Title = "Banks"; }
@(Html.Kendo().Grid<PosPayAndBankRec.Models.BankListItem>()
 .Name("Banks")
 .Columns(BankGridCommandDef)
 .DataSource(BankGridDataSource)
        .ToolBar(BankGridToolBarDef)
        .Editable(c => c.Mode(GridEditMode.InLine).Enabled(true).DisplayDeleteConfirmation(true))
        .Sortable()
    .Pageable(p => p.Enabled(false))
        .Scrollable(s => { s.Height(400); s.Virtual(true); })
      )
    

Alex
Top achievements
Rank 1
 answered on 08 Oct 2012
4 answers
3.1K+ views
Is there any way to tell through an event type mechanism when the drop down is done binding to data?  I am loading a drop down with a list through a datasource bound to remote data and need to initialize the value based on another data field retrieved previously.  I also need to fill in other controls through MVVM based on the data in the drop down list, so simply setting the drop down list initial value isn't enough for this.

The time to load the drop down seems to vary, and a timeout isn't working very well at that point, so it would be helpful to know when the drop down is finished and can safely have its value set through code.

If there is no event (which it doesn't appear there is from the documentation) is there a known way to handle this situation?  I should probably point out that I'm fairly new to javascript, so if there is something obvious that I'm missing, please excuse my ignorance!
Alexander Valchev
Telerik team
 answered on 08 Oct 2012
2 answers
284 views
Hello,
We're having a slight issue where when a page loads it displays controls momentarily as the unstyled versions of Kendo UI controls even in development (e.g. no network latency to load resources).  This seems to be a FireFox issue as Chrome is not showing the delay, but it is certainly there in FF 15.0.1.

When the page loads the controls are unstyled, then they are styled.  Is it possible to hook into some Kendo or jQuery framework event to know when Kendo thinks it is done initializing and styling all Kendo controls on the page (or maybe we can look at the last control on the page and base it off that).  We are wanting to prevent this flicker of unstyled to styled controls.


The style initialization we are doing is below: 
  $('#something).kendoNumericTextBox({
            format: "n0",
            spinners: false,
            decimals: 0
        });
Dimo
Telerik team
 answered on 08 Oct 2012
1 answer
171 views
Hello,

It seems there is an issue of calculating selected index of a tabstrip, if has inner tabstrip with selected index other than zero.
Here is jsfiddle 
http://jsfiddle.net/qd3YZ/210/

You can see that value in alert depends on the current tab of inner tabstrip which is wrong. Looks like shown value is the sum of two selected indices.
What is the workaround to find selected index of top tabstrip?
When are you going to fix this?

Thanks,
Ihor
Dimo
Telerik team
 answered on 08 Oct 2012
0 answers
104 views
Hey, could someone please help me with descent peace of code how to save a SVG to file system and then convert it to png, I looked at a lot of samples but couldnt make them work for me.
Any atempt appreciated.
Heres my code for the chart;

$("#chart3").kendoChart({
                        theme: $(document).data("kendoSkin") || "default",
                        dataSource: {
                            transport: {
                                read: {
                                    url: "Data/data.json",
                                    //url: "ChartDataService.svc/DoWork",
                                    dataType: "json"
                                }
                            }                           
                        },
                        title: {
                            text: "Daily Alarm Rate"
                        },
                        legend: {
                            visible: false,
                            position: "top"
                        },
                        seriesDefaults: {
                            type: "scatter",
                            color: "#347C2C",
                            labels: {
                                visible: true,
                                template: "#= series.name #",
                                position: "right"
                            }
                        },


                        series: [{
                            xField: "ChartUpsPerc",
                            yField: "Avg"
                        }],


                        xAxis: {
                            min: 0,
                            labels: {
                                format: "${0}"
                            },
                            title: {
                                text: "Price"
                            }
                        },
                        yAxis: {
                            min: 0,
                            labels: {
                                format: "{0}%"
                            },
                            title: {
                                text: "Performance Ratio"
                            }
                        },
                        tooltip: {
                            visible: true,
                            format: "{0:N0}",
                            template: "Date: ${dataItem.Avg}<BR>Value: ${value}"
                        }
                    });
Neil
Top achievements
Rank 1
 asked on 08 Oct 2012
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
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)
SPA
Filter
Drawing API
Drawer (Mobile)
Globalization
Gauges
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
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
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
Popover
DockManager
FloatingActionButton
TaskBoard
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
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?