Telerik Forums
Kendo UI for jQuery Forum
2 answers
202 views
Heya Telerik,

I've noticed an inconsistency in how row data is passed to the detailInit callback on the grid widget when I'm using the detailTemplate.  When the Grid widget is loaded via jquery ($("#grid").kendoGrid()) then the detailInit callback receives a event.data argument that is set to the data for that row, as you would expect.  When the Grid widget is loaded via data attributes (data-role="grid") the detailInit callback receives a event.data argument that is set to the dataSource of the entire grid.  This means I am unable to access the Id, or any other data for that matter, for the row i'm interested in.

To demonstrate what I'm talking about, here's a JS fiddle.  Click on the green block to expand the row: http://jsfiddle.net/ducka/SXcT4/

I've traced the behavior back to the "widget" binder in kendo.binder.js:
binders.widget = {
        events : Binder.extend({
            init: function(widget, bindings, options) {
                Binder.fn.init.call(this, widget.element[0], bindings, options);
                this.widget = widget;
                this.handlers = {};
            },
 
            refresh: function(key) {
                var binding = this.bindings.events[key],
                    handler = this.handlers[key];
 
                if (handler) {
                    this.widget.unbind(key, handler);
                }
 
                handler = binding.get();
 
                this.handlers[key] = function(e) {
                    // >> ISSUE: This line here is overwriting the row data with an instance to the binding source of the grid.
                    e.data = binding.source;
 
                    handler(e);
 
                    if (e.data === binding.source) {
                        delete e.data;
                    }
                };
 
                this.widget.bind(key, this.handlers[key]);
            },
 
            destroy: function() {
                var handler;
 
                for (handler in this.handlers) {
                    this.widget.unbind(handler, this.handlers[handler]);
                }
            }
        }),
I assume this is not correct behavior?

Lucas
Top achievements
Rank 1
 answered on 04 Aug 2013
2 answers
299 views
I'm using a Grid with remote data source and php wrappers. In the remote data source I'm using php DataSourceResult as also shown in the Kendo UI Demos.

For security reasons I would like to add a mandatory filter on the server side. For example I would like users to only have access to records where column 'enabled' = 1 in a MySQL table. So before my calling the read() method of my DataSourceResult I would like to add this filter. How can I do this?

Users should not be able to see the 'enabled' column on the client side and/or alter the filter with a bit of hacking to be able to see the "enabled = 0" records.
$request = json_decode(file_get_contents('php://input'));
$result = new DataSourceResult($dsn, $username, $password, $driver_options);
$table = 'users';
$columns = array('id', 'name');
// Add the mandatory "enabled = 1" filter here
$data = $result->read($table, $columns, $request);

Oscar
Top achievements
Rank 2
 answered on 02 Aug 2013
1 answer
199 views
Hi - I'm trying to create a Scatter Chart bound  to remote data, and grouped.  I'm not getting something right.  Attached is a screen shot that shows the data I'm getting from my JSON call, what the chart currently looks like(note the series name, something is wrong with where I am doing my grouping) and an example of a chart I'm working from.

I have looked at the demos for the scatter chart, I'm just not seeing what I'm missing.

Thanks - here is the code that creates the chart:

//Crosstab
       kcSchoolCrosstab = $("#SchoolCrosstab").kendoChart({
           title: {
               text: "Crosstab",
               font: "bold 16px Arial,Helvetica,Sans-Serif"
           },
           legend: {
               visible: false
           },
           dataSource: {
               transport: {
 
                   read: function (options) {
                       if (!(ktvSchoolFilter && ktvSchoolFilter.getSelectedSchoolCodes() && getSelectedSchoolYear())) {
                           options.success([]);
                           return;
                       }
                       kendo.ui.progress(kcSchoolCrosstab.element, true);
 
                       $.getJSON(Helpers.toServicesUrl("/GetEWSSchoolCountVsRiskScore"),
 
                   {
 
                       username: WSIPCContext.UserName,
                       districtId: WSIPCContext.DistrictId,
                       schoolCodes: ktvSchoolFilter.getSelectedSchoolCodes(),
                       schoolYear: getSelectedSchoolYear,
                       //                      countOfEvents: 3,
                       countOfEvents: getRiskCatCount(),
                       whereIds: "1"
                   }).success(function (data) {
                       options.success([]);
                       kcSchoolCrosstab.dataSource.data(data.GetEWSSchoolCountVsRiskScoreResult.RootResults);
                   }).always(function () {
                       kendo.ui.progress(kcSchoolCrosstab.element, false);
                   });
                   },
    
                   group: {
                       field: "GradeLevel"
                   },
 
                   sort: {
                       field: "StudentCount"
                   }
               }
                
           },
                    
           series: [{
               type: "scatter",
               xField: "StudentRiskFactor",
               yField: 'StudentCount',
               color: "#4F82BE",
               name: "#= group.value"
           }],
 
           legend: {
               position: "bottom"
           },
 
           xAxis: {
               labels: {
                   step: 2,
                   format: "{0}%"
               },
               title: {
                   text: "Avg. School Risk Score"
               }
           },
 
           yAxis: {
               labels: {
                   skip: 2,
                   step: 2
               },
 
               title: {
                   text: "Avg. School Count",
                   margin: {
                       right: 10
                   }
               }
           },
 
 
           chartArea: {
               height: 300,
               width: 520
           }
       }).data("kendoChart")



Thanks - Lisa
Iliana Dyankova
Telerik team
 answered on 02 Aug 2013
3 answers
185 views
I have data for 11 month, date 02/26/2012, 03/25/2012,
04/26/2012….. 12/30/2012.

I want to show those dates on Axis labels.  

set it to Date and base unit of a month
           
          with format of MM/dd/yyyy 
 

This code will show first date of the month. 02/01/2012,
03/01/2012 and so on. It doesn’t show the accrual date . If I remove Date and
baseUnit it will show each week. Can you tell me how to accomplish this.

 

Thanks

 
Iliana Dyankova
Telerik team
 answered on 02 Aug 2013
1 answer
140 views
Hello,

I don't understand why the Drag&Drop demo isn't operational in IE9 in a specific computer.
When I click on the yellow circle, I cannot move it.

I use the same IE9 version in an other computer and the demo is operational.

Thanks
Dimiter Madjarov
Telerik team
 answered on 02 Aug 2013
1 answer
371 views
Hello I would like to
know what the syntax for opening a partial page is. I would like to show a partial page as the content of an expanded bar. I also would like to pass the model as an argument when calling the partial page.

I unsuccessfully tried using the .Content like this

.Content(@<text>Html.PartialPage("_TestPartial2")</text>)

Another question I would like to add is:

in the .Content I was able use both html and Razor syntaxes. However I am not sure if I can use C# logical statements such as "if" or "while" statement.



Could you give me an example for both of them please?



Thanks.

Dimo
Telerik team
 answered on 02 Aug 2013
1 answer
923 views
Hi,

I can't seem to get the Scheduler datasource read operation to work.

Scheduler initialization:
self.scheduler = $('#scheduler').kendoScheduler({
                views: ["day", { type: "week", selected: true }, "month", "agenda"],
                culture: "nl-NL",
                allDaySlot: false,
                majorTick: 60,
                minorTickCount: period.CustomersPerHour != 0 ? period.CustomersPerHour : 4,
                date: new Date(period.From),
                startTime: new Date("2013/6/6 08:00"),
                endTime: new Date("2013/6/6 21:00"),
                editable: {
                    template: $("#editor").html()
                },
                dataSource: {
                    batch: false,
                    transport: {
                        read: {
                            url: "/api/appointment",
                            dataType: "json"
                        },
                        update: {
                            url: "/api/appointment/update",
                            dataType: "json"
                        },
                        create: {
                            url: "/api/appointment/create/?periodId=" + period.Id + '&periodType=' + period.$type,
                            dataType: "json",
                            contentType: "application/json"
                        },
                        destroy: {
                            url: "/api/appointment/destroy",
                            dataType: "json"
                        },
                    },
                    schema: {
                        model: {
                            Id: "Id",
                            fields: {
                                Id: {
                                    from: "Id",
                                    type: "number"
                                },
                                Title: {
                                    from: "Title",
                                    defaultValue: "No title",
                                    validation: {
                                        required: true
                                    }
                                },
                                Description: {
                                    from: "Description"
                                },
                                Start: {
                                    type: "date",
                                    from: "Start"
                                },
                                End: {
                                    type: "date",
                                    from: "End"
                                },
                                IsAllDay: {
                                    type: "boolean",
                                    from: "IsAllDay"
                                }
                            }
                        }
                    }
                },
            }).data("kendoScheduler");

WebApi code (the WebApi is set to return JSON):
[HttpGet]
public IEnumerable<Appointment> Get()
{
      return this.unitOfWork.Repository<Appointment>().Get;
}

WebApi response:
[{"$type":"Banden_Inn.Data.Entities.Models.Appointment, Banden-Inn.Data.Entities","Title":"Afspraak 1","Description":null,"Start":null,"End":null,"IsAllDay":false,"Id":1,"Created":"2013-08-02T13:58:33.853","Edited":null},{"$type":"Banden_Inn.Data.Entities.Models.Appointment, Banden-Inn.Data.Entities","Title":"Afspraak 2","Description":null,"Start":null,"End":null,"IsAllDay":false,"Id":2,"Created":"2013-08-02T13:58:33.857","Edited":null}]

Appointment entity (Base class contains id, created etc..):
public class Appointment : Base
    {
        public string Title { get; set; }

        public string Description { get; set; }

        public DateTime? Start { get; set; }

        public DateTime? End { get; set; }

        public bool IsAllDay { get; set; }
    }

What am I doing wrong? I'm missing something, but can't seem to figure out what?!
Thanks in advance!


Kind regards,
Ruud Prinsen
Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Aug 2013
1 answer
63 views
Init the scheduler with Editable = false, go to Agenda View... mouse over items, notice the "X" and the hand cursor when going over the X.

Also - on the Resources example:
http://demos.kendoui.com/web/scheduler/resources.html

"attendees" is spelled wrong in the code.

atendees: { from: "Atendees", nullable: true },
Kiril Nikolov
Telerik team
 answered on 02 Aug 2013
2 answers
188 views
I am trying to build a chart using kendo mvvm but can't seem to figure out how to template the labels on the chart (category axis, value axis, and series labels).

This is ideally what I would like the chart to look like
http://jsbin.com/uvarit/4/edit

And can get the chart to render
http://jsbin.com/obojiz/2/edit

I just can't figure out how to add the label templates in. Needing to delimit a string within a string within a string, some sort of Stringception or something.

Thanks.
Robin
Top achievements
Rank 1
 answered on 02 Aug 2013
1 answer
130 views
I;m using the below code and was wondering to I need to rework my data call to include transport in order to get  virtual scrolling to work or am I missing something else?

Thanks


function LoadSubGrid_DX09(a, c) {

                       var Data = jQuery.ajax(

                           {
                               async: true,
                               type: "POST",
                               traditional: true,
                               url: "JSONService.asmx/Storefront_SubGrid_1",
                               data: "{'Sample_Type':'" + c + "', 'Disease_Site':'" + a + "'}",
                               contentType: "application/json; charset=utf-8",
                               dataType: "json",
                               serverPaging: true,
                               serverSorting: true,
                               pageSize: 100,
                               beforeSend: function () {
                                document.getElementById('subgrid1').innerHTML = "";
                                $(".fountainTextG").show();
                               },

                               success: function (responsedata) {
                                   $(".fountainTextG").hide();
                                   document.getElementById('subgrid1').innerHTML = "";
                                   $("#subgrid1").kendoGrid({
                                       dataSource: jQuery.parseJSON(responsedata.d),// new kendo.data.DataSource({data:jsonData}),
                                       toolbar: kendo.template($("#template").html()),
                                       height: 430,
                                       scrollable: {
                                           virtual: true
                                       },
                                       change: onChangeSubGrid,
                                       selectable: "multiple",
                                       sortable: true,
                                       resizable: true,
                                       groupable: true,
                                       reorderable: true,
                                       dataBinding: function () {
                                         record = 0;
                                       },
                                       columns:
                                           [
                                           {
                                               title: "&nbsp;",
                                               template: "#= ++record #",
                                               width: 75
                                           },

                                                { hidden: true, field: "DONOR_ID" },
                                                { hidden: true, field: "EVENT_ID" },
                                                { hidden: true, field: "FORM_CODE" },
                                                { hidden: true, field: "EXTERNAL_NUMBER" },
                                                { field: "DISEASE_SITE", title: "Disease Site", width: 100 },
                                                { field: "SAMPLE_TYPE", title: "Sample Type", width: 100 },
                                                { field: "SAMPLE_NUMBER", title: "Sample Number", width: 125 },
                                                { field: "COLLECTION_DATE", title: "Collection Date", width: 100, format: "{0:MM/dd/yyyy}" },
                                                { field: "SAMPLE_CATEGORY", title: "Category", width: 100 },
                                                { hidden: true, field: "PATHOLOGY_NO" },
                                                { hidden: true, field: "PROCEDURE_DATE" },
                                                { hidden: true, field: "DIAGNOSIS_DATE" },
                                                { field: "PROCEDURE_TYPE", title: "Procedure Type", width: 115 },
                                                { field: "PRIMARY_SITE", title: "Primary Site", width: 100 },
                                                { field: "HISTOLOGY", title: "Histology", width: 150 },
                                                  { field: "FORM_DETAILS", title: "Details", width: 150 },
                                                    { field: "EXTERNAL_DATA", title: "External Data", width: 150 },
                                                { field: "COMMENTS", title: "Comments", width: 100 }
                                           ]

                                   });
                               
                               },
                               error: function (xhr, ajaxOptions, thrownError) {
                                   alert(xhr.statusText);
                                   alert(thrownError);
                               }
                           });
                }

Petur Subev
Telerik team
 answered on 02 Aug 2013
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
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?