Telerik Forums
Kendo UI for jQuery Forum
11 answers
4.0K+ views
Hi All,

I have a ListView object in my page that is linked to a DataSource(contains name and ID), and formatted with a Kendo Template object. A user is going to select one of the items in the list, then I need to capture the Selected Item's ID from the data source. I cannot figure out how to do this properly

I figured out how to get the Selected Item from a drop down list.
var id = $("#dbdropdownlist").data("kendoDropDownList").value().toString();

But I cannot figure out how to do something similar with the ListView object. I assume I want to use the 'Select()' method, but that returns an HTML object(I assume from the template), which means that I have to search through child objects and stuff...seemd too complicated.

Any one have an idea of how to accomplish what I have outlined above? Any help would be appreciated.
Greg

OS: Windows 7
Browser: Chrome 17.0.963.83
Kendo UI Beta v2012.1.229 
jQuery JavaScript Library v1.7.1  
Nikolay Rusev
Telerik team
 answered on 24 Feb 2014
1 answer
175 views
I have to Colour a Column based on its value after searching sometime found this solution which worked well in firefox. but in other browsers its causing the grid to lose all the rows.

Here is my grid
@(Html.Kendo().Grid<EDENEMS.WEB.Models.AccountModel>()
        .Name("Accountsgrid")
        .Columns(columns =>
        {
            columns.Bound(c => c.AccountName).ClientTemplate("<a class='GridLink' href='" + Url.Action("AccountView", "Accounts", new { Id = "#=AccountID#" }) + "'>#=AccountName#</a>").Width(180);
            //columns.Bound(c => c.AccountName).Width(180);
            columns.Bound(c => c.FullAddress);
            columns.Bound(c => c.AccountType).Width(120).ClientTemplate("#=Getcoloured(AccountType)#");
            columns.Bound(c => c.PhoneNumber).Width(100);
            columns.Bound(c => c.EmailAddress).Width(150);

        })
        .HtmlAttributes(new { style = "height: 355px;" })
        .Scrollable()
        .Sortable()
        .Filterable()
        .Selectable()
        //.Events(e=>e.DataBound("onDataBound"))
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Accounts_Read", "AccountsGrid"))
        )
    )

this is the function 
function Getcoloured(value) {
        if (value && value != null && value.contains('A') == 1)
            return "<span style='color:#00B067'>" + value + "</span>";
        else if (value && value != null && value.contains('B') == 1)
            return "<span style='color:#4F81BD'>" + value + "</span>";
        else if (value && value != null)
            return "<span style='color:#B366C0'>" + value + "</span>";
        else 
            return ""
    }

Is there any other way to achieve Colouring a column based on the value.

Dimiter Madjarov
Telerik team
 answered on 24 Feb 2014
6 answers
897 views
Hi, 

i have a view that is a special case and i dont want it to have scolling if the content of the view is longer than the viewport. 

its just a view with a header and footer and some content and its being wrapped by scrollwrapper. 

whats the best way to disable it, something like overflow:hidden;
Kiril Nikolov
Telerik team
 answered on 24 Feb 2014
1 answer
181 views
Our requirements for a batch grid include showing the textboxes in every grid cell all of the time, not just when a user tabs into a specific cell. I've tried dummying up my own styles to no avail. Is there a more elegant way like rowtemplates where we can just show the textbox in every cell all the time? 

I have attached a picture as an example of what we are looking for.
Atanas Korchev
Telerik team
 answered on 24 Feb 2014
1 answer
606 views


I find the kendoui chart has two methods :refersh method and redraw method,what is the difference?I think both of them is to draw the chart again. But if the chart is binding from remote data according to ajax,the request will not fire again.

$("#Chart").data("kendoChart").redraw();
$("#Chart").data("kendoChart").refresh();
I have a situation,at first I have a page which is to draw a chart with autobind from remote data,Now I want to add a line in this chart,it means I have to change the datasource( add the line data to the datasource),Which method should I use best?I find use refresh or redraw method are both OK.
T. Tsonev
Telerik team
 answered on 24 Feb 2014
1 answer
175 views
hi there,
I've been trying to pass a model to a partial view that is accessed by a kendo tabstrip. but I cant get it to work. is this even possible?

here is my view

@(Html.Kendo().TabStrip()
        .Name("tabsStrip")
        .Items(items =>
        {
            items.Add()
                .Encoded(false)
                .Text("Computer <span class='k-state-active'></span>")
                .Content(Html.Partial("_Computer", ComputerModel).ToHtmlString())  -> is there a way to pass the computer model to the partial view?                
               .Selected(true);
            items.Add()
                .Encoded(false)
                .Text("User <span></span>")
                .Content(Html.Partial("_User").ToHtmlString());      
        }))
Daniel
Telerik team
 answered on 24 Feb 2014
3 answers
1.5K+ views
Hi

I can add buttons to a command column in a grid and trigger click events fine. What I want to do now is add a command button to my row template

In the row template I have

#if (IsMe) {# <a class="k-button k-grid-delete">Delete</a> #} #

And then in my document ready function I have

$("#grid").on("click", ".k-grid-delete", function () {
              alert("click delete command");
          });

This works and the message appears whenever I click on one of the delete buttons, however what I want to do when the user clicks is make an ajax call that deletes the item from its ID property....

When using a command column I would do something like

function delete(e) {
          e.preventDefault();
 
          var dataItem = this.dataItem($(e.currentTarget).closest("tr"));

i could then use dataItem.ID to reference the ID of the relevant row.

How can I do this for the button I have created above in the row template?

Many thanks


Huw Lloyd
Top achievements
Rank 1
 answered on 24 Feb 2014
1 answer
462 views
Hello,

I have a simple datasource with the following schema:
schema: {
                data: "Items",
                total: "Count",
                model: {
                    Id: { type: "number" },
                    Name: { type: "string" },
                }
            }


I use the datasource for a dropdown.
When i select a value and programatically check the $("#CountyId").data('kendoDropDownList').value() I get the correct id (an int value)

Because I use the dropdown in a cascading scenario i need to transform the Id field on the model in a CountyId.
So after reading the documentation i decided to transform my schema into:

schema: {
                data: "Items",
                total: "Count",
                model: {
                    CountyId: { type: "number", from: 'Id' },
                    Name: { type: "string" },
                }
            }


Yet, now when I check the selected value: $("#CountyId").data('kendoDropDownList').value() I get an [object Object]

Please tell me what I am doing wrong.

Thank you


Alexander Popov
Telerik team
 answered on 24 Feb 2014
1 answer
121 views
Hi,

I wondered if it possible to create a 100% stacked columns? Like the image.

Regards.
Iliana Dyankova
Telerik team
 answered on 24 Feb 2014
3 answers
179 views
Hi there

I want my area chart to have a solid line following the data points - so it LOOKS like both a line chart and area chart plotting the same data, except I only want to use one data series and style it up.   Is it possible?

See attached screenshot - I'm struggling to put it into words!

Bonus question if I may - is it possible to add the second border to the chart as in the image?  I can control the plotArea main border but can't see how to add a second border.
Michaël
Top achievements
Rank 1
 answered on 23 Feb 2014
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
Drag and Drop
Application
Map
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
DropDownTree
ListBox
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
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?