Telerik Forums
Kendo UI for jQuery Forum
2 answers
141 views

I have the following code adding xml datasource to a template. The data comes over but is not formatted as a collapse ui. This is in Appbuilder hybrid ui.

<div data-role="view" data-title="Events" data-layout="main" data-model="app.eventView" data-show="app.eventView.onShow" data-after-show="app.eventView.afterShow">
 
    <!-- START_CUSTOM_CODE_eventView -->
    <!-- Add custom code here. For more information about custom code, see http://docs.telerik.com/platform/screenbuilder/troubleshooting/how-to-keep-custom-code-changes -->
    <div class="msf-event-header">
    
    </div>
 
 
            <div id="msf-events" data-use-native-scrolling="true"></div>
 
            <script id="msf-event-template" type="text/x-kendo-template">
                <div data-role="collapsible">
                    <h3><span class="event-title">#= title #</span><span class="event-date">#= date #</span> <span class="event-location">#= location #</span><span></span></span></h3>
                    <p>#= body #</p>
                    <p>
                     <a href="" data-role="button" data-animated="true" clas="km-primary">Add to Calendar</a> <a href="" data-role="button" data-animated="true" clas="km-primary">Get Tickets</a>
                    </p>
                </div>
            </script>
 
 
            <script>
                 
  
                    function onChage() {
                        $("#msf-events").html(kendo.render(template, this.view()));
                    }
 
                    var template = kendo.template($("#msf-event-template").html());
                 
                    var dataSource = new kendo.data.DataSource({
                        transport: {
                            read: "http://msf.bitphaser.com/?q=msf-events"
                        },
                        schema: {
                            type: "xml",
                            data: "/events/event",
                            model: {
                                fields: {
                                    title: "title/text()",
                                    date: "field_date/text()",
                                    location: "field_location/text()",
                                     body: "body/text()",
                                }
                            }
                        },
                        change: onChage
                    });
 
                    dataSource.read();
 
            </script>
 
     
    
    <!-- END_CUSTOM_CODE_eventView -->
</div>

n/a
Top achievements
Rank 1
 answered on 09 Aug 2016
2 answers
1.2K+ views

I have a rest service that returns one field as an array of strings:

 

"$9":"0071", "NAMES": ["Chris Bob","Jim Kuster","Rick Dill","David Scope","Bryan Tim" ]

 

My JS looks like this:

//Set URL of Rest Service
var loc = (location.href);
var url = loc.substring(0,loc.lastIndexOf("/")) + "/xpRest.xsp/xpRest1";

var dataSource = new kendo.data.DataSource({
transport: {
        read: {
            url: url,
            type: 'GET'
        },batch: false
},
pageSize: 15,
});


dataSource.read();


$("#grid").kendoGrid({
dataSource: dataSource,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
height: 543,
noRecords: true,
selectable : false,
columns : [{
field : "$9",
title : "Location",
width : 75
},{
field: "D_APPRNAME",
title : "Approvers"
  }],
}); 
});

The output in the column is [Object][Object]

Does someone have an example or a fiddle to help me with this?
Bryan
Top achievements
Rank 1
 answered on 09 Aug 2016
2 answers
109 views

Thank you in advance for any feedback:

1) Am I defining correctly the parameters to be passed on my vm.audit.load function on the grid data source?

$(document).ready(function () {
    var vm = kendo.observable(fhfa.vm.default({
        container: $("#app-main"),
        appVersion: audit.constants.appVersion
    }));

    //***grid data***
    var o = audit.auditCollection({});
    vm.set("audit", o);

   // kendo.bind($("#app-main"), vm);

 

     $("#grid").kendoGrid({
        //data: vm.audit.load,

        dataSource: {
            p : function(){

                //*** Search criteria values ***
                var auditTypeCB = $("#auditType").data("kendoComboBox");
                auditTypeID: checkIfZeroOrBlank(auditTypeCB.select());

                startDate: checkIfZeroOrBlank($("#sDate").val());
                endDate: checkIfZeroOrBlank($("#eDate").val());

                var applicationCB = $("#appDropDownList").data("kendoComboBox");
                applicationID: checkIfZeroOrBlank(applicationCB.select());

                auditUser: checkIfZeroOrBlank($("#user").val());
                ipAddress: checkIfZeroOrBlank($("#ipAddress").val());
                auditDescription: checkIfZeroOrBlank($("#description").val());

                pageOffset: null;
                pageSize: 0;
                orderBy: null;
                orderByDirection: null
            },
            schema: {
                data: "audit.items"
            },
            transport: {
                read: function (options) {
                    vm.audit.load(p.applicationID, p.auditTypeID, p.auditUser, p.ipAddress, p.startDate, p.endDate, p.auditDescription, p.pageOffset, p.pageSize, p.orderBy, p.orderByDirection, p.pageMax).then(function () {
                        options.success(data);
                    });
                }
            }
        },
        columns: [{
            field: "applicationID",
            hidden: true
        },
        {
            field: "auditTypeID",
            title: "Type"
        },
        {
            field: "auditDate",
            title: "Date",
        },
        {
            field: "applicationName",
            title: "Application",
        },
        {
            field: "auditUser",
            title: "User"
        },
        {
            field: "iPAddress",
            title: "IP Address"
        },
        {
            field: "auditDescription",
            title: "Description"
        }],
        scrollable: true,
        groupable: true,
        reorderable: true,
        sortable: true,
        selectable: true
    });

 

 audit.auditCollection = function (init) {
    var o = fhfa.object.baseCollection(init);
    o._name = "auditCollection"
    o._createObject = function () {
        return audit.audit(init);
    };
    o.onloading = function (args) {
        vm = this;
        kendo.ui.progress(vm._view.element, args.isLoading);
    };
    o.load = function (applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection, pageMax) {
        var that = this;

        var vPageSize = 100;
        var vCount = 0;
        var def = $.Deferred();
        that._isLoading = true;

        if (pageSize === 0) {
            pageSize = vPageSize;
        }

        audit.da.auditItems_get(applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection, vPageSize, pageMax).done(function(eResult) {
            var items = eResult.d.auditItems;
            vCount = eReResult.d.auditItems.lenght;
            that.set("total", vCount);
            that.addArray(items);

            def.resolve(that);
        }).fail(function (error) {
            if (init.onerror) init.onerror({ source: that, sourceType: that._name, error: error });
            def.resolve(that);
        }).always(function () {
            that._isloading = false;
        });     

        return def.promise();
    };

Rocio
Top achievements
Rank 1
 answered on 09 Aug 2016
1 answer
404 views
Hello! 

 

When I use this code to disable 2nd and 3rd tab in each detailed row I see that only first expanded row has those tabs disabled - and all other rows that I expand are enabled - what am I doing wrong? Thanks for help!

var tabStrip = $("#mytabstrip").kendoTabStrip().data("kendoTabStrip");
            tabStrip.disable(tabStrip.tabGroup.children().eq(1));
            tabStrip.disable(tabStrip.tabGroup.children().eq(2));

 
<script type="text/x-kendo-template" id="template">
         <div class="tabstrip" id="mytabstrip">
             <button id="gridButton">gridButton</button>
             <ul>
                 <li class="k-state-active" id="AccountsTab">
                     Счета                       
                 </li>
                 <li id="AccountInfoTab">
                     Полная информация по счету:
                 </li>
                 <li id="BillEventsTab">
                     Просмотр событий по счету:
                 </li>
             </ul>
             <div>
                 <div id="account" class="Account"></div>
             </div>
              
         </div>
 
     </script>
Dimiter Topalov
Telerik team
 answered on 09 Aug 2016
1 answer
1.1K+ views

I have a page with kendoui slider, where i am checking if slider value is valid inside slider change event.
If value isn`t valid, i want to roll back slider value to previous value,  
But every time i set slider value (roll back to previous value) inside change event it doesn't work. 
For instance, mySlider initial value is 2.
The user is trying set the value to 10 but my validation function returns false (illegal value) and set my Slider back to it's initial value (2).
For some reason, right after that, the value of my Slider has been set up to 10 (the user choise) again(!!)
So practically my validation function has no meaning!!
It happens inside kendo.all.js in the function :

trigger: function (eventName, e) {
                var that = this, events = that._events[eventName], idx, length;
                if (events) {
                    e = e || {};
                    e.sender = that;
                    e._defaultPrevented = false;
                    e.preventDefault = preventDefault;
                    e.isDefaultPrevented = isDefaultPrevented;
                    events = events.slice();
                    for (idx = 0, length = events.length; idx < length; idx++) {
                    events[idx].call(that, e); ////////////////////////////////////////////////Here it change back to the user choise    
                    }
                    return e._defaultPrevented === true;
                }
                return false;
  },

My Code:

var slider =$("#slider").kendoSlider({
orientation: "vertical",
smallStep:1000,
largeStep:5000,
min:0,
max:100000,
value:50000,
change:Calc
});

function Calc(e){
    if (!(IsValid(e.value)))
   {
      $("#slider").data("kendoSlider").value(prevVal);
   }
}   ////////////////////////////////////////////////Here it calls to:trigger: function (eventName, e) which written above

Is there some any way to do it?

Tanks.

 


Misho
Telerik team
 answered on 09 Aug 2016
1 answer
404 views

Hello,

I'm attempting to create a masked datepicker using AngularJS.

I tried something like this, but it's not working :

 

<input kendo-date-picker
k-mask="00/00/0000"
k-options="{format: 'dd/MM/yyyy'}"
ng-model="vm.Filters.ToDate" />

Do you have a dojo of the solution ?

 

Thank you.

SLM
Top achievements
Rank 1
 answered on 09 Aug 2016
2 answers
223 views

Hi,

I'm attached to task edit and save events. When I open the task edit popup and change one field, I need to update the task end date. I tried editing e.task.end, e.values.end fields. The problem is, that when I click save and the save event is triggered, the values in e.values are filled with old values so the task is saved with old values.

Is there any way to update those values in the "edit" event, so when the "save" event is triggered, my task values are updated?

Thanks a lot,

Paweł

Paweł
Top achievements
Rank 1
 answered on 09 Aug 2016
2 answers
207 views

Hi,

 

I have a function which opens kendowindow. I am writing a qunit test case to test that particular function whether the particular function is working or not. Please help me with below snippet, where am i going wrong.

Function: addNew: function (e) {

            $("[data-Address]").data("kendoWindow").open();
        }

Test case:

QUnit.test("address", function (assert) {
        var wnd = $("[data-Address]").data("kendoWindow");
       var test= wnd.element.is(":hidden"); 
        cart.addNew();
        assert.equal($("test", false, "address");
    });

 

plz help me where am I gng wrong.

 

Thanks in advance.

Mohnish
Top achievements
Rank 1
 answered on 09 Aug 2016
3 answers
643 views

I'm using kendo Telerik.UI.for.AspNet.Mvc5 version 2016.2.607 in .net 452

i have my culture type in web.config set as:

<globalization uiCulture="de" culture="de-DE" />

if i use the following code to localize my website, it works fine (see 'first.png')

<script src="@Url.Content("~/Scripts/kendo/2016.2.607/cultures/kendo.culture." + System.Globalization.CultureInfo.CurrentCulture.Name + ".min.js")"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                kendo.culture("@System.Globalization.CultureInfo.CurrentCulture.Name");
            });
        </script>

if i remove that code and use @Html.Kendo().Culture() instead, i en-US date values (see 'second.png')

if i do a view source, the @Html.Kendo().Culture() seems to be working fine, see below.

<script>kendo.cultures["de-DE"]={name:"de-DE",numberFormat:{pattern:["-n"],decimals:2,",":".",".":",",groupSize:[3],percent:{pattern:["-n %","n %"],decimals:2,",":".",".":",",groupSize:[3],symbol:"%"},currency:{pattern:["-n $","n $"],decimals:2,",":".",".":",",groupSize:[3],symbol:"€"}},calendars:{standard:{days:{names:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],namesAbbr:["So","Mo","Di","Mi","Do","Fr","Sa"],namesShort:["So","Mo","Di","Mi","Do","Fr","Sa"]},months:{names:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],namesAbbr:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]},AM:[""],PM:[""],patterns:{d:"dd.MM.yyyy",D:"dddd, d. MMMM yyyy",F:"dddd, d. MMMM yyyy HH:mm:ss",g:"dd.MM.yyyy HH:mm",G:"dd.MM.yyyy HH:mm:ss",m:"d. MMMM",M:"d. MMMM",s:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",t:"HH:mm",T:"HH:mm:ss",u:"yyyy'-'MM'-'dd HH':'mm':'ss'Z'",y:"MMMM yyyy",Y:"MMMM yyyy"},"/":".",":":":",firstDay:1}}};</script>

what am i missing?

Daniel
Telerik team
 answered on 09 Aug 2016
2 answers
97 views

Hi,

I'm trying to create a stacked chart and i'm having trouble with the results - the stacked data is not a sum of all data points but rather an artificial number. I've made a dojo sample here http://dojo.telerik.com/EFIhUQ - the second column shoudl be 4 and it shows up as 120000... any idea why?

Daniel
Telerik team
 answered on 09 Aug 2016
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?