Telerik Forums
Kendo UI for jQuery Forum
1 answer
280 views
Hi,

I have the following read method defined in the datasource of my Kendo grid.

.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.SomeID))
.Create(update => update.Action("EditingPopup_Create", "ControllerName"))
.Read(read => read.Action("EditingPopup_Read", "ControllerName").Data("additionalInfo"))
.Update(update => update.Action("EditingPopup_Update", "ControllerName"))
.Destroy(update => update.Action("EditingPopup_Destroy", "ControllerName"))

I make the following call to get data back from the EditingPopup_Read() method:

$("#grid").data("kendoGrid").dataSource.read();
$("#grid").data("kendoGrid").refresh();

The read() call hits the controller via a POST. The EditingPopup_Read() method prepares an array of models, and passes it back like this "return Json(models);"

I can see that JSON does in fact get passed back using Fiddler, however the Kendo grid either ignores it or refuses to display it, despite my call to refresh() the grid.  






Rosen
Telerik team
 answered on 26 May 2014
1 answer
232 views
Hi,

I want to use MVVM and bind the page widgets to an object.  This object has child objects.  Something like a Customer Order object which has a property of Customer Order Lines which is an IEnumerator of Customer Line Objects.  So the widgets on the page are bound to the Customer Order object and the grid widget is bound to the Customer Order Lines property of the Customer Order Object. I am having trouble creating the Kendo.Model to represent this.  Is this possible and if so could you please help or point me in the direction of an example.

I was hoping to create a page based on the above where a user could create a Customer Order and Customer Order Lines or edit an existing one.

Please help.

Thanks
Vladimir Iliev
Telerik team
 answered on 26 May 2014
3 answers
225 views
Hi Kendo Team,
I'm iterating the collection dataSource.data() and I want to know if a data item of this collection is deleted or not.
There is isNew() method that tells you if the user created a new item, but how can i know if an item of the dataSource was deleted by the user? Is there any IsDeleted() method ?
Something like:
for (var i= 0; i < dataSource.data().length; i++){
   if (!dataSource.data()[i].isDeleted()){  
        // Do whatever
   }
}
Kind regards,
Oscar.
Kiril Nikolov
Telerik team
 answered on 26 May 2014
1 answer
222 views
How could I catch the event when user change the navigator's selected range?
for example, 
$("#stock-chart").kendoStockChart({
    navigator: {
    series: {
       type: "line",
       field: "volume"
    },
    select: {
       from: "2012/01/01",
       to: "2012/03/01"
    }
},
...
})
 I just want to do something when user change the selected range of the navigator. Is there any api for the event? 
T. Tsonev
Telerik team
 answered on 26 May 2014
11 answers
390 views
I notice stock chart has navigator.  http://demos.telerik.com/kendo-ui/dataviz/financial/index.html
Does other chart such as area chart  support navigator?
Thanks
T. Tsonev
Telerik team
 answered on 26 May 2014
3 answers
199 views
The Update request below is being sent as an HttpGet - how do you change the transport to indicate that it should be a post?

@(Html.Kendo().Scheduler<CIC.Web.UI.Models.TaskViewModel>()
    .Name("scheduler")
    .Date(DateTime.Now)
    .StartTime(DateTime.Now)
    .ShowWorkHours(true)
    .Height(600)
    .Views(views =>
    {
        views.DayView();
        views.WorkWeekView(workWeekView => workWeekView.Selected(true));
        views.WeekView();
        views.MonthView();
        views.AgendaView();
    })
    .Editable(editable =>
    {
        editable.TemplateName("_EditorForEventTemplate");
    })
    .Events(e =>
    {
        e.Edit("scheduler_edit");
        e.Change("scheduler_change");
    })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.TaskID);
            m.Field(f => f.Title).DefaultValue("New Event");
            m.Field(f => f.SponsorID);
            m.Field(f => f.ContactEMail);
        })
        .Events(e => e.Error("error_handler"))
        .ServerOperation(true)
        .Read(read => read.Action("Events_Read", "Home").Data("getAdditionalData"))
        .Create("Events_Create", "Home")
        .Destroy("Events_Destroy", "Home")
        .Update("Events_Update", "Home")
    )
    .Resources(resource =>
    {
        resource.Add(tvm => tvm.SponsorID)
            .Title("CompanyName")
            .DataTextField("DBAName")
            .DataValueField("CompanyID")
            .DataSource(ds => ds.Read(read => read.Action("GetSponsors", "Home")));

        resource.Add(tvm => tvm.EventType)
            .Title("Description")
            .DataTextField("Description")
            .DataValueField("Code")
            .DataSource(ds => ds.Read(read => read.Action("GetEventTypes", "Home")));
    })
    
)
Rosen
Telerik team
 answered on 26 May 2014
1 answer
141 views
I can't seem to find the right configuration to display notes in a Bar type Sparkline. What I would like is to have them displayed below the stacked bar series. Is this possible?
Josh
Top achievements
Rank 1
 answered on 23 May 2014
5 answers
439 views
I have a grid that has columns from other tables. When I update the grid with data I loose the data that is referencing the foreign table values. Is there a way to retain these values. The values are not being updated in the grid they are just there for reference.

Thanks
Software
Top achievements
Rank 2
 answered on 23 May 2014
5 answers
428 views
So I have a myViewModel.js that I read in. which has the datasource, but I doesn't seem to call destroy.
Also the kendo.data.ObservableObject.fn.init.apply(that, []);  confuses me.  I wish there were more mvvm examples that are read in from a js file.

in my html I got:
$("#dgGrid").kendoGrid({
      groupable: false,
      sortable: true,
 
      editable: "inline",
      columns: [
              {
                  field: "accountId",
                  title: "User #",
                  width: "50px"
 
              },
 
          {
              field: "currentAmt",
              title: "Amount",
              width: "100px"
 
          },
     { command: [{ name: "destroy", template: "<div class='k-button'><span class='k-icon k-delete'></span></div>" }], title: " ", width: 40 }
     
 
 
      ]
  });
<div id="dgGrid" data-role="grid" style="width:340px; font-size:9px; height:250px"
 
     data-bind="source: userAccountsDataSource">
    <style type="text/css">
        .k-grid tbody .k-button {
            min-width: 12px;
            width: 30px;
        }
    </style>
</div>

(function (global) {
    var FlossViewModel,
        app = global.app = global.app || {};
 
    FlossViewModel = kendo.data.ObservableObject.extend({
  
        acountId: "",
        accountNick: "",
        newbcId: "q",
        userId: "0",
        checkDate: "",
        errorMsg: "",
        accountsVis: true,
         
     
        userAccountsDataSource: "",
 
 
    
 
        refreshAccount: function(){
            this.populateAccounts();
 
        },
        populateAccounts: function(){
            var that = this;
 
           // kendo.data.ObservableObject.fn.init.apply(that, []);
            var dataSourceaa = new kendo.data.DataSource({
 
                transport: {
 
                    read: {
                                type: "GET",
                                dataType: "jsonp",
                                url: '/api/FlossAccount/'
                                    },
 
                    destroy: {
                        type: "DELETE",
                        url: function (options) {
                            return '/api/FlossAccount/1';
                        },
 
                        dataType: "jsonp",
                        data: {'' : '333'}, //i'm just putting any data for now
                        cache: false
 
 
 
                    },
                    parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            return { models: kendo.stringify(options.models) };
                        }
                    }
                },
 
                error: function (e) {
                    that.set("errorMsg", "Error: Check Connection ");
                    dataSourceaa.cancelChanges();
 
                }
            });
 
          that.set("userAccountsDataSource", dataSourceaa);
 
 
            dataSourceaa.read();
         //  this.set("userAccountsDataSource", dataSourceaa);
 
        },
   
         .....
 
    });
 
    app.flossService = {
        viewModel: new FlossViewModel()
    };
})(window);

Alexander Valchev
Telerik team
 answered on 23 May 2014
2 answers
279 views
When I set any of my events to include a RecurrenceRule, I suddenly can't double-click on any of the events without getting the javascript error:

Uncaught TypeError: Cannot read property 'isOccurrence' of undefined

What is causing this and how can I fix it?

I'm doing an ajax call to retrieve the data, then re-binding it to the Scheduler control.  Here is my code:

            // When the JSON comes back, it will capital letters like Title and Start.  The scheduler needs these lower case, so define the model.
            var dataSource = new kendo.data.SchedulerDataSource({
                data: response.Data,
                schema: {
                    model: {
                        id: "ID",
                        fields: {
                            ID: { type: "number" },
                            title: { field: "Title", defaultValue: "No title", validation: { required: true } },
                            start: { type: "date", field: "Start" },
                            end: { type: "date", field: "End" },
                            description: { field: "Description" },
                            recurrenceId: { from: "RecurrenceID" },
                            recurrenceRule: { from: "RecurrenceRule" },
                            recurrenceException: { from: "RecurrenceException" },
                            ownerId: { field: "OwnerID", defaultValue: 1 },
                            isAllDay: { type: "boolean", field: "IsAllDay" }
                        }
                    }
                }
            });

            scheduler.setDataSource(dataSource);

and here is the json that is being returned:

{"Success":true,"Data":[{"Id":69314,"EventType":"Event","Title":"Event 69314","Start":"\/Date(1400772600000)\/","StartTimezone":null,"End":"\/Date(1400785200000)\/","EndTimezone":null,"Description":null,"IsAllDay":false,"Recurrence":null,"RecurrenceRule":"FREQ=DAILY","RecurrenceException":null,"EventTitle":"Air duct cleaning","AssociatedWithType":"Job","AssociatedWithId":8225,"AssociatedWithName":"25854 Maclure","JobId":"25854","Color":"#991aae","Pending":false,"Completed":false,"BackgroundColor":"#c1e4ef","FontColor":"#ff0000","ResourceDisplay":"Abigail","Resources":[{"Id":299,"Name":"Abigail","Available":false,"IsDefaultChecked":false,"Type":null,"Color":null}],"EventDuration":210,"EventDurationWorkDayPixels":47,"MinutesBeforeWorkDayStart":90,"MinutesBeforeWorkDayStartPixels":20},{"Id":69312,"EventType":"Event","Title":"Event 69312","Start":"\/Date(1400414400000)\/","StartTimezone":null,"End":"\/Date(1400454000000)\/","EndTimezone":null,"Description":null,"IsAllDay":false,"Recurrence":null,"RecurrenceRule":null,"RecurrenceException":null,"EventTitle":"Air duct cleaning","AssociatedWithType":"Job","AssociatedWithId":22345,"AssociatedWithName":"a","JobId":"a","Color":"#FFC0CB","Pending":false,"Completed":false,"BackgroundColor":"#c1e4ef","FontColor":"#ff0000","ResourceDisplay":"Chelsea","Resources":[{"Id":2,"Name":"Chelsea","Available":false,"IsDefaultChecked":false,"Type":null,"Color":null}],"EventDuration":660,"EventDurationWorkDayPixels":147,"MinutesBeforeWorkDayStart":-120,"MinutesBeforeWorkDayStartPixels":-27}]}

Scott
Top achievements
Rank 1
 answered on 23 May 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
Licensing
PivotGridV2
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?