Telerik Forums
Kendo UI for jQuery Forum
5 answers
1.2K+ views
I binding datasource to generate the tabs dynamically in tabStrip control. For each tab in tabstrip i have a check box on the form. My Requirement is: 
initially all the tabs will be disabled and on check change event of checkboxes i need to enable or disable the respective tabs based on check state of the currently changing checkbox.

I have already tried below code: 

var cb_click = function (e) {
            var $this = $(this);     // $this will contain a reference to the checkbox  
            var tabstrip = $("#myTabStrip").data("kendoTabStrip");
            var selTab = tabstrip.select(tabstrip.tabGroup.children("li[innerText='" + $this.val() + "']"));
            if ($this.is(':checked')) {
                tabstrip.enable(selTab, true);
            }
            else {
                tabstrip.enable(selTab, false);


                //selTab.css('class', 'k-state-disabled');
            }
        };

Please help me find a solution for this issue.
Petyo
Telerik team
 answered on 13 Oct 2014
1 answer
479 views
I have a Button control (State) and a DropDownList control (Inspection Building Control: Create) - see attached image.
I want then to be beside each other and styled like a ButtonGroup in the ToolBar also shown in the image.

What I currently have is almost there but you can see that the left side of the DropDownList control isnt flat - it still has the rounded edges.
I need the DropDownList to be styled like "k-button-group k-group-end" any ideas how to do it?

Alternatively and even better would be if I could just add a DropDownList control into a TooBars ButtonGroup (which only seems to accept buttons)


@model IStateful
@{
    //Output controls to add to ToolBar
    string ddlStates =
            "<div class='k-button-group'>" +
            Html.Kendo().Button()
                .Name("lblCurrentState")
                .HtmlAttributes(new { type = "button", @class = "k-group-start ignoreChange" })
                .ImageUrl(Url.Content("~/Images/16px/gears_run.png"))
                .Content("State")
                .Enable(true)
                .ToHtmlString()
            +
            Html.Kendo().DropDownList()
            .Events(e =>
            {
                e.Change("workflowTransitionState");
            })
            .Name("workflowTransitions")
            .DataTextField("Text")
            .DataValueField("Value")
            .BindTo((SelectList)ViewBag.Transtions)
            .HtmlAttributes(new {id="workflowTransitions",@class = "k-group-end", @style = "width:300px;margin-left:0px"})
            .ToHtmlString()
            +
            "</div>";
}
<div id="workflowToolbar">
@(Html.Kendo().ToolBar()
  .Name("tbWorkflow")
    .Items(items =>
    {
        items.Add().Template(@ddlStates).Overflow(ShowInOverflowPopup.Never);
        items.Add().Type(CommandType.ButtonGroup).Buttons(buttons =>
        {
                buttons.Add().Text("Bold").Togglable(true).SpriteCssClass("k-tool-icon k-bold").ShowText(ShowIn.Overflow);
                buttons.Add().Text("Italic").Togglable(true).SpriteCssClass("k-tool-icon k-italic").ShowText(ShowIn.Overflow);
                buttons.Add().Text("Underline").Togglable(true).SpriteCssClass("k-tool-icon k-underline").ShowText(ShowIn.Overflow);
        });
    })
)  
            







Alexander Valchev
Telerik team
 answered on 13 Oct 2014
2 answers
127 views
Hallo,

we have a typical master / detail scenario, where we want to display projects on one view and the corresponding categories on a detail view. Until the latest version we manged to do this by using two different datasources (one per view). The first datasource loads the data via transport.read from a JSON webservice. Each project allready contains all depending categories. Because of that we used the first datasource to populate the second one by getting the selected item via uid. This item contains a property with the corresponding categories. These categories are used as data for the second datasource. (transport.read) With the current version this method stopped working. We are getting a "object not found" error, when returning back from detail view and trying to set the currentSelectedItem within the viewmodel with another project. It seems, that the parent() method is now missing on the project dataitems within the first datasource. 

Any ideas on how to do it right? Is it a bug within the new version, or is our approch not the way to do this kind of task?

DataSource1
     >> Projects

DataSource2
     >> Categories (Project.Categories)

Thanks,
Martin
BeOne Stuttgart
Top achievements
Rank 1
 answered on 11 Oct 2014
3 answers
200 views
I am currently using knockout-js with kendo to make a funnel chart. I have the following set-up:

 this.chartOptions = ko.observable({
series: [{
                type: "funnel",
                dynamicSlope: false,
                field: "data",
                categoryField: "description",
                dynamicHeight: false,
                segmentSpacing: 5,
                labels: {
                    color: "#000",
                    visible: true,
                    background: "transparent",
                    align: "center",
                 //   template: "#= category#<br/>#= value#",
                    template: "#= category#: #= kendo.format('{0:p}',value)#",
                    font: "11px sans-serif; font-weight: bold",
                },
            }],
            tooltip: { 
                visible: true,
                template: "#= category#<br/>#= kendo.format('{0:p}',value/dataItem.parent()[0].data)#",
                color: "#FFF"
            }

});
My issue is that for some reason, if I add a breakline in the template string for the chart labels, it stops rendering. It completely breaks. However, the exact same template layout in the tooltip works perfectly. This is what I want:  template: "#= category#: <br /> #= kendo.format('{0:p}',value)#", Many thanks for any help.




T. Tsonev
Telerik team
 answered on 10 Oct 2014
2 answers
279 views
I have a Grid Editor Template for a Date field and it takes the format dd-MMM-yyyy. However I continuously get the error 'field [property name] is not a valid date'. I have had this issue on a regular view and got round it by using a custom date parsing function and using this to validate dates:

//Manage the JQuery/Kendo date parsing issue
            kendo.culture("en-GB");
            $.validator.addMethod('date',
                function (value, element) {
                   
                    //return this.optional(element) || kendo.parseDate(value)
                    return this.optional(element) || Date.parse(element.value) //Custom function
                });

However this does not appear to work on the Editor Template for a Kendo grid. My Editor Template code looks like the following:

@model DateTime?
 
@(
    Html.Kendo().DatePickerFor(m => m).Format("dd-MMM-yyyy").ParseFormats(new [] {"dd-MMM-yyyy"})
)
 
 
<script src="@Url.Content("~/Scripts/date.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/cultures/kendo.culture.en-GB.min.js")"></script>
<script type="text/javascript">
 
 
    $(document).ready(function () {
 
        kendo.culture("en-GB");
        $.validator.addMethod('date',
            function (value, element) {
                return this.optional(element) || Date.parse(element.value)
            })
    });
 
 
    //$('#DateStarted').kendoValidator({
    //    dateValidation: function (element) {
    //        debugger;
    //        var value = $(element).val();
 
    //        var date = Date.parse(value);
    //        if (!date) {
    //            return false;
    //        }
 
    //        return true;
    //    }
    //});
 
 
</script>

How can i resolve this issue?




Siobhan McTear
Top achievements
Rank 1
 answered on 10 Oct 2014
8 answers
950 views
Hello,

I have a grid that loads data from a web-service. A server paging and virtual scrolling are enabled.
Let's consider the following scenario:
1) Run a report (Unzip the solution and press F5)
2) Scroll grid down and stop in the middle => data is loaded properly from a web service. See img1.png: the top row id is 4096

Now let's assume the server data is changed and I need manually refresh the current page.
3) Click "Refresh DS" button => data is reloaded, but it is shifted (!). See img2.png: the top row id is 4135

I attached the sample project that demonstrates the issue.
My JavaScript code is in testReport.js file.

Could you please review the project and advise how to manually refresh the active view without data shifting: only "value" column should be updated but a row ID before and after "refresh" must be the same.

Alexander
Top achievements
Rank 1
 answered on 10 Oct 2014
1 answer
445 views
I've got an application where I need to present a list of photos, and allow the user to select photos, which are then added to a second list (list 2), which is above the original list (list 1).  When list 2 contains 6 items, another action should happen.  I'm wondering if the kendo ListView can accomplish this design requirement?  

I'm struggling a bit with figuring out how to select items in the listview without deselecting all other items - is that possible, and if so, how?  Another requirement is that if the user selects an item, then clicks it again, it should be removed from list 2, and deselected in list 1.  In other words, one click selects an item in the list, a second click on that same item deselects it.  I do have selectable set to 'multiple'.

Does the listview's 'change' event trigger when an item is added to the listview, or just if an item is clicked in the listview?  If the latter, is there an event that will notify me if an item is added to the listview, or do I handle that in the dataSource?

Finally, I would like to provide a default image for the six items in list 2, which would be replaced when those items are populated by selected items in list 1.  See the attached screenshot for an example.  I can't figure out how to use the template system to accomplish this.  I haven't used the drag and drop controls before, perhaps those would be a better candidate for this implementation? 

Ideally there's an example out there somewhere I can look at to see how this is done, but any help is appreciated.

Thanks!
Alexander Valchev
Telerik team
 answered on 10 Oct 2014
5 answers
422 views
So I have a page where I'm using a combobox to allow users to filter some data by Contact.

I now have a requirement to pre-filter this data from a value passed by a querystring parameter.

I am initially thinking about automating the combobox using the client-side api and have found the commands I need.

I've chucked a temporary button onto my page to test out the script (I will probably execute this from the document ready function in the final app)

$("#btnTest").click(function () {
  try {
    $("#contactFilter").data("kendoComboBox").text("MySurname");
    $("#contactFilter").data("kendoComboBox").search();
    $("#contactFilter").data("kendoComboBox").select(function (dataItem) { return dataItem.Id === "myUserId" });
    $("#contactFilter").data("kendoComboBox").close();
  } catch (e) {
    if (console) console.log(e.message);
  }
});

If I execute these steps individually from the console I get the required effect.  The text is entered, the search runs, the contact is selected and the combobox closes.

However, because the data is remote, the .select() and .close() execute before the .search() has completed.

Is there any way to chain these commands so that the .select() only fires after the .search() has completed?

The combobox is currently declared thus:

$("#contactFilter").kendoComboBox({
  placeholder: "contact name",
  dataTextField: "Name",
  dataValueField: "Id",
  template: kendo.template($("#ContactFilterItemTemplate").html()),
  filter: "contains",
  autoBind: false,
  minLength: 3,
  delay: 500,
  dataSource: {
    type: "json",
    serverFiltering: true,
    transport: {
      read: {
        url: Cmdb.SiteRoot + "Groupings/ContactsTypeahead",
        global: false,
        data: function () {
          return {
            filterString: $("#contactFilter").data("kendoComboBox").input.val()
          };
        }
      }
    }
  }
});


Cheers,
Nick

Kiril Nikolov
Telerik team
 answered on 10 Oct 2014
1 answer
148 views
I am trying to create nodes with template that includes  @Ajax.ActionLink  :

 @(Html.Kendo().TreeView()
                            .Name("actiontree")
                            .BindTo(Model, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) =>
                            {
                                mappings.For<myspace_menu>(bound => bound.ItemDataBound((node, myspace_menu) =>
                                {

                                    bool isaco = myspace_menu.controller.Length > 0;
                                    node.Text = myspace_menu.label;
                                    node.ImageUrl = isaco ? Url.Content("~/img/act.png") : Url.Content("~/img/folder.png");
                                    
                                    if (isaco)
                                    {

                                        node.Template.InlineTemplate = @<text>@Ajax.ActionLink(myspace_menu.label, "uberitem", 
                                        new { c= myspace_menu.controller, a=myspace_menu.action },
                                        new AjaxOptions
                                                      {
                                                          HttpMethod = "POST",
                                                          InsertionMode = InsertionMode.Replace,
                                                          UpdateTargetId = "accessconfig"
                                                      })</text>;
                                    }


                                })
                                .Children(e => e.items));

                            })
                        )  





This actually works - asynchronously updates  "accessconfig" div.
However
problem 1:  Instead of POST  it does GET (but I don't run any javascript and have unobtrusive referenced and enabled ).
problem 2 - main one:   inlinetemplate content (link) looks like CHILD node of node I added it into  instead of normal appearance (see attached picture).

Also, note I tried version with javascript onselect - it works, but I need to have ajax.ActionLink  there.
How can I make inlinetemplate work with Ajax.Actionlink ? How make a link appear as a node text?

thank you !


Denis










Daniel
Telerik team
 answered on 10 Oct 2014
0 answers
104 views
Hi guys, I just wanted to share this code in case anyone need it, because I didn't find nothing similar on the forum.

This example loads a kendo menu dinamically from an aspx page, getting the elements from a server method accessed by ajax

.cs file

 [WebMethod(EnableSession = false)]
        public static string GetToolsAdminProjects()
        {
            List<Project> toolsAdminProjectList = ProjectsHelper.GetToolsAdminProjectList();
            List<ContextMenuItem> result = toolsAdminProjectList.Select(e=> new ContextMenuItem
            {
                text = e.DisplayName,
                url = e.URL
            }).ToList();

            var serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(result);
            return json;
        }

.aspx file 
<script type="text/javascript">

 $.ajax({
                 type: "POST",
                 url: "GridView.aspx/GetToolsAdminProjects",
                 data: "{}",
                 contentType: "application/json",
                 dataType: "json",
                 success: function (result) {
                     var d = jQuery.parseJSON(result.d)
                     var menu = $("#menu").data("kendoMenu");
                     menu.append(d);
                 }
             });

</script>

ITServices
Top achievements
Rank 1
 asked on 10 Oct 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
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?