Telerik Forums
Kendo UI for jQuery Forum
3 answers
207 views

I've been working on a map project, and I had shapeClick working, but suddenly it stopped working.  I was working on other parts of the page, but I don't think any of them would have caused this problem.  I've been banging my head against it for 2 hours, and I still have no idea why it won't trigger the shapeClick event any more.

 Here's the function I'm using to create the map and the onShapeClick function as well.  I've got multiple bubble layers, but the one I've been trying to click on the bubbles for is the first one with the dataSource: BLOCKS.

function createMap() {
        $("#map").kendoMap({
            center: [38.268107, -97.744821], zoom: 4,//These two options may be something to set to div options
            height: 400,
            layers: [{
                type: "bing",
                imagerySet: "aerialWithLabels",
                key: "Ajo4NRDLFtd7zTT_LKi4lHrCZCWahx69-ZjmruTcGlBNdIPDUD--iWmlmWl5We_E"
            }, {
                type: "bubble",
                dataSource: BLOCKS,
                locationField: "Location",
                valueField: "Value",
                symbol: function(e) {
                    var map = $("#map").data("kendoMap");
 
                    var location = e.location;
                    var circleGeometry = new geom.Circle(e.center, e.dataItem.Value);
                    //var rectGeometry = new geom.Rect([e.center[0] - 20, e.center[1] - 10], [e.center[0] + 20, e.center[1] + 10]);
 
                    //alert(e.dataItem);
                    //alert(e.shape);
 
                    // Draw the circle shape
                    //
                    var circle = new draw.Circle(circleGeometry, {
                        fill: {
                            color: e.dataItem.Color,
                            opacity: 0.7
                        },
                        stroke: {
                            width: 0
                        }
                    });
 
                    // Draw the text
                    //
                    var text = new draw.Text(e.dataItem.Name, e.center, {//e.dataItem.Name
                        font: "12px sans-serif"
                    });
             
                    // Align it in the circle center
                    //
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-align
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-vAlign
                    draw.align([text], circle.bbox(), "center");
                    draw.vAlign([text], circle.bbox(), "center");
 
                    circle.dataItem = e.dataItem;
                    circle.bubbleType = "block";
                    //alert(1);
                    $(circle).click(function () {
                        alert(this);
                        alert(this.dataItem);
                    });
                    //alert(2);
                    text.dataItem = e.dataItem;
                    text.bubbleType = "block";
                    $(text).click(function () {
                        alert(this);
                        alert(this.dataItem);                       
                    });
                    var symbol = new draw.Group();
                    symbol.append(circle, text);
                    symbol.dataItem = e.dataItem;
                    symbol.bubbleType = "block";
                    $(symbol).click(function () {
                        alert(this);
                        alert(this.dataItem);
                    });
 
                    return symbol;
                }
            }, {
                type: "shape",
                dataSource: shapes
            }
            , {
                type: "bubble",
                dataSource: pingBubbles,
                locationField: "Location",
                valueField: "Value",
                symbol: function (e) {
                    var map = $("#map").data("kendoMap");
 
                    var location = e.location;
                    var circleGeometry = new geom.Circle(e.center, e.dataItem.Value);
                    //var rectGeometry = new geom.Rect([e.center[0] - 20, e.center[1] - 10], [e.center[0] + 20, e.center[1] + 10]);
 
                    //alert(e.dataItem);
                    //alert(e.shape);
 
                    // Draw the circle shape
                    //
                    var circle = new draw.Circle(circleGeometry, {
                        fill: {
                            color: e.dataItem.Color,
                            opacity: 0.7
                        },
                        stroke: {
                            width: 0
                        }
                    });
 
                    // Draw the text
                    //
                    var text = new draw.Text(e.dataItem.Name, e.center, {//e.dataItem.Name
                        font: "12px sans-serif"
                    });
 
                    // Align it in the circle center
                    //
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-align
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-vAlign
                    draw.align([text], circle.bbox(), "center");
                    draw.vAlign([text], circle.bbox(), "center");
 
                    circle.dataItem = e.dataItem;
                    circle.bubbleType = "ping";
                    text.dataItem = e.dataItem;
                    text.bubbleType = "ping";
                    var symbol = new draw.Group();
                    symbol.append(circle, text);
                    symbol.dataItem = e.dataItem;
                    symbol.bubbleType = "ping";
 
                    return symbol;
                }
            }, {
                type: "bubble",
                dataSource: incidentBubbles,
                locationField: "Location",
                valueField: "Value",
                symbol: function (e) {
                    var map = $("#map").data("kendoMap");
 
                    var location = e.location;
                    var circleGeometry = new geom.Circle(e.center, e.dataItem.Value);
                    //var rectGeometry = new geom.Rect([e.center[0] - 20, e.center[1] - 10], [e.center[0] + 20, e.center[1] + 10]);
 
                    //alert(e.dataItem);
                    //alert(e.shape);
 
                    // Draw the circle shape
                    //
                    var circle = new draw.Circle(circleGeometry, {
                        fill: {
                            color: e.dataItem.Color,
                            opacity: 0.7
                        },
                        stroke: {
                            width: 0
                        }
                    });
 
                    // Draw the text
                    //
                    var text = new draw.Text(e.dataItem.Name, e.center, {//e.dataItem.Name
                        font: "12px sans-serif"
                    });
 
                    // Align it in the circle center
                    //
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-align
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-vAlign
                    draw.align([text], circle.bbox(), "center");
                    draw.vAlign([text], circle.bbox(), "center");
 
                    circle.dataItem = e.dataItem;
                    circle.bubbleType = "incident";
                    text.dataItem = e.dataItem;
                    text.bubbleType = "incident";
                    var symbol = new draw.Group();
                    symbol.append(circle, text);
                    symbol.dataItem = e.dataItem;
                    symbol.bubbleType = "incident";
 
                    return symbol;
                }
            }, {
                type: "bubble",
                dataSource: SELECTEDBLOCKS,
                locationField: "Location",
                valueField: "Value",
                symbol: function (e) {
                    var map = $("#map").data("kendoMap");
 
                    var location = e.location;
                    var circleGeometry = new geom.Circle(e.center, e.dataItem.Value);
                    //var rectGeometry = new geom.Rect([e.center[0] - 20, e.center[1] - 10], [e.center[0] + 20, e.center[1] + 10]);
 
                    //alert(e.dataItem);
                    //alert(e.shape);
 
                    // Draw the circle shape
                    //
                    var circle = new draw.Circle(circleGeometry, {
                        fill: {
                            color: e.dataItem.Color,
                            opacity: 0.7
                        },
                        stroke: {
                            width: 0
                        }
                    });
 
                    // Draw the text
                    //
                    var text = new draw.Text(e.dataItem.Name, e.center, {//e.dataItem.Name
                        font: "12px sans-serif"
                    });
 
                    // Align it in the circle center
                    //
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-align
                    // http://docs.telerik.com/kendo-ui/api/javascript/drawing#methods-vAlign
                    draw.align([text], circle.bbox(), "center");
                    draw.vAlign([text], circle.bbox(), "center");
 
                    circle.dataItem = e.dataItem;
                    circle.bubbleType = "block";
                    text.dataItem = e.dataItem;
                    text.bubbleType = "block";
                    var symbol = new draw.Group();
                    symbol.append(circle, text);
                    symbol.dataItem = e.dataItem;
                    symbol.bubbleType = "block";
 
                    return symbol;
                }
            }
            ],
            shapeClick: onShapeClick
        });
    }
 
    function onShapeClick(e) {
        alert('hola');
    }

As you can see, I tried adding click events to the symbol as well, but that's not working either.

 In case it matters, here's the DataSource definition for BLOCKS:

var BLOCKS = new kendo.data.DataSource({
        type: "odata",
        schema: {
            data: "data",
            model: {
                fields: {
                    BlockId: { type: "number" },
                    Name: { type: "string" },
                    Value: { type: "number" },
                    Location: { type: "object" },
                    Color: { type: "string" },
                    CurrentRouteName: { type: "string" },
                    VehicleId: { type: "number" },
                    VehicleName: { type: "string" },
                    EmployeeId: { type: "number" },
                    EmployeeName: { type: "string" }
                }
            }
        }
    });
 

 

T. Tsonev
Telerik team
 answered on 08 Jul 2015
3 answers
148 views
Hi, I am inserting data to a grid using a seperate button  and refreshing the partial view the grid is in, the changes show up correctly, but then the delete/update dont post back to their actions anymore. this only occures when i refresh the partial view that the grid is in.
Alexander Popov
Telerik team
 answered on 08 Jul 2015
11 answers
310 views
I've implemented the Javascript version of the Kendo UI Editor with full server-side Image Browser support. The browser and editor work like a charm in most cases, except when there's an error uploading an image that happens before it gets to my server-side error handling.

I'm referring to images bigger than 4MB, which is my server's maximum request length. When this happens, the process errors out before it hits my server-side code, and the Image Browser doesn't provide any notification to the user that their upload failed or why it failed. I looked through the documentation, and there doesn't seem to be any error handling functions available for me to insert my own error notifications into.

Is there something I'm missing? Can I use one of the other error handling functions?
Barry P
Top achievements
Rank 1
 answered on 08 Jul 2015
4 answers
121 views

Hi, I have a partial view "_AccountUsers" with just the following grid:

 
        @(Html.Kendo().Grid<LiteraSite.LiteraProjectSvc.UserDTO>((List<LiteraSite.LiteraProjectSvc.UserDTO>)TempData["AccountUsers"])
    .Name("grdAccountUsers")

    .Columns(columns =>
    {
      columns.Bound(p => p.Email).Title("Email").HtmlAttributes(new { @style = "padding-left: 8px;" });
        columns.Bound(p => p.UserName).Title("Account Users").HtmlAttributes(new { @style = "padding-left: 5px;" });
        columns.Bound(p => p.FirstName).Title("Account Users").HtmlAttributes(new { @style = "padding-left: 5px;" });
        columns.Bound(p => p.LastName).Title("Account Users").HtmlAttributes(new { @style = "padding-left: 5px;" });
        columns.Bound(p => p.Active).Title("Active").HtmlAttributes(new { @style = "padding-left: 5px;" }).Template(@<input @(item.Active ? "checked='checked'" : "") value='active' type='checkbox' />);
        columns.Command(command =>
        {
            command.Edit().UpdateText("");
            command.Destroy();
        }).Width(170);
       // columns.Command(command=> command.Custom("Delete").Action("DeleteUser","Administration")).Width(170);

    })
                        .Pageable()
                        .Navigatable()
                        .Selectable(selectable => selectable.Enabled(true))
                                .Editable(editing => editing.Mode(GridEditMode.InLine))
                        .Scrollable(src => src.Height(300))

                            .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .ServerOperation(false) 
                                    .Model(model => model.Id(p => p.UserID))
                                    .Model(model=>model.Field(o=>o.Email).Editable(false))
                                                     .Model(model => model.Field(o => o.UserName).Editable(false))
                                                              .Model(model => model.Field(o => o.FirstName).Editable(false))
                                                                       .Model(model => model.Field(o => o.LastName).Editable(false))
                                    .Destroy(update => update.Action("DeleteUser", "Administration"))
                                            .Update(update => update.Action("UpdateUser", "Administration"))
                                    )

        )

and the delete user action looks like this:

   [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult DeleteUser([Kendo.Mvc.UI.DataSourceRequest] Kendo.Mvc.UI.DataSourceRequest request,
            UserDTO user)
        {
            (new Models.ProjectModel()).DeleteUser(user.UserID);
            SetAccountUsers();
            return Json(((List<UserDTO>)TempData["AccountUsers"]).ToDataSourceResult(request, ModelState));          
        }

 

 

 

here is where i load the partial view:

 

@{
    ViewBag.Title = "User Administrator";
}

@section scripts {
    @Styles.Render("~/Contents/Control/administrator")
    <link href='@Url.Content("~/Contents/Styles/themes/kendo/kendo.common.min.css")' rel="stylesheet" />
    <link href='@Url.Content("~/Contents/Styles/themes/kendo/kendo.metro.min.css")' rel="stylesheet" />
    <script src='@Url.Content("~/Contents/Scripts/kendo.all.min.js")'></script>
    <script src='@Url.Content("~/Contents/Scripts/kendo.aspnetmvc.min.js")'></script>
    <script src='@Url.Content("~/Contents/Scripts/jquery.unobtrusive-ajax.js")'></script>
    @Scripts.Render("~/bundles/administrator")
    <script type="text/javascript">
        $(document).ready(function () {
            initiate('@ViewBag.ErrMessage');
        });

    </script>
}

<fieldset class="reportContent">

    
    @using (Ajax.BeginForm("SearchUserByEmail", new AjaxOptions { UpdateTargetId = "foundUser" }))
    {
       <label> A user can only be added if they have registered with Orissa as a user. New users can register <a>here</a></label><br/>
        <label>Email:</label>
        <input type="text" name="email" />
           
        <button id="btnSearch" class="k-button submit" value="Search">
            <img src='@Url.Content("~/Contents/Images/search_icon.bmp")' height="20" width="20" />
        </button>
        
        <label style="color:red">@ViewBag.UserNotFound</label>
    }

    <div id="foundUser">                 
      @Html.Partial("_FoundUser")
    </div>


    <div id="accountUsers">   <============================= This is the partial view
        @Html.Partial("_AccountUsers")
    </div>
</fieldset>

 

 

 

When I add a new row then immediately delete it, i get a new page opened with json data. If i delete an already existing (old) record it deletes fine, what am i doing wrong?

Daniel
Telerik team
 answered on 08 Jul 2015
4 answers
210 views

The remove-filter button [X] is being partially superimposed upon the filter icon in IE11, Chrome, and Opera (I haven't tested other browsers).  See attached screen shot.

 I'm referencing kendo.common.min.cs and kendo.default.min.cs -- is there another stylesheet that must be referenced as well?

Thanks

Radoslav
Telerik team
 answered on 08 Jul 2015
1 answer
476 views

Hi,

 

I am really new to the Kendo UI Controls and thinking to integrate it in my web application.

The issue I am facing is binding the Treeview with the HTML tags as my dataTextField.

 

My controller is returning me List of strings, which I use for binding as JSON data to my VIEW.

The list of string contains string as below

"<span id='spn1' style=' font-weight: bold;'>text1</span> <a href='someFunction()'>text2</a> text3"

So, my Tree-node should display me output as :

text1 text2 text3

 

Instead of this, it displays my tree as-is with HTML tags. like above string.

So, What really concern is, is it possible to achieve my target? And if yes, What is the solution on this?

 

Alexander Popov
Telerik team
 answered on 08 Jul 2015
5 answers
880 views
Is there any way to make the drop down portion of a Kendo DropdownList as wide as necessary to accomodate the content? As you can see in the attached image, the text "(ascending)" is being cut off because the dropdown portion is only as wide as the parent. This is a fully responsive app, so the dropdown itself is going to be bigger or smaller, based on the device/browser size, so the solution will need to work for that condition.
Plamen Lazarov
Telerik team
 answered on 08 Jul 2015
2 answers
507 views

Hi there,

I have a page with multiple Kendo dropdownlists on it, working fine.  However, I want each to have the selected value set based on a session value.  I have approached this in 2 ways :-

a) Return a JSON-ed list of items, with the appropriate one marked as selected, and then bind the .Value property to the selected value
b) Use JS after the list is ready to set the selected item

I can't get either to work.  My code is below, please assist.

Thanks, Mark

MVC VIEW CSHTML :-

 @( Html.Kendo().DropDownList()
            .Name("compliances")
            .DataTextField("Text")
            .DataValueField("Value")
            .Filter("contains")
            .Value("Selected")
            .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Action("PopulateComplianceFilter", "Site");
                })
                .ServerFiltering(false);
            })
            .Events(e =>
            {
                e.Change("ComplianceChange");
            })
        )

CONTROLLER C# CODE :-

    // Populate compliances on filter panel
            public ActionResult PopulateComplianceFilter([DataSourceRequest]DataSourceRequest request)
            {
                List<Compliance> col = Enum.GetValues(typeof(Compliance)).Cast<Compliance>().ToList();
                Array values = Enum.GetValues(typeof(Compliance));
                List<ListItem> items = new List<ListItem>(values.Length);

                // convert enum list to select item list to get values displayed on front end
                foreach (Enum i in values)
                {
                    items.Add(new ListItem
                    {
                        Text = EnumHelper.GetDisplayName(i),
                        Value = ((int)(Compliance)i).ToString(),
                        Selected = (((int)(Compliance)i) == sessionHelper.SiteFilter_ComplianceID)?true:false
                    });
                }
                return Json(items, JsonRequestBehavior.AllowGet);
            }

Mark
Top achievements
Rank 1
 answered on 08 Jul 2015
3 answers
604 views

I have a <div> that is bound to an MVVM View Model.  Inside the <div> I have a Kendo Grid.  I can't use the normal "data-" attributes because the column template syntax combined with razor syntax just does not mix.  So, I'm trying to create the grid using the $('#grid').kendoGrid(); syntax.

 My problem is that I don't see anyway to bind the dataSource of the grid to my dataSource inside the View Model.  Is this possible?

Alexander Valchev
Telerik team
 answered on 08 Jul 2015
1 answer
166 views

Hi,

I have Grid with DropDown list. DropDown list has attributes filter and group.  After selecting some value in DropDown list, attribute "group" causes "undefined". Here is my code:

...... kendoGrid({

dataSource: {

data: data.obmedzenia,
schema: {
model: {
fields: {
obmedzenie: {
defaultValue: {
nazov: "(§ 51 ods. 3 písm)",
kod: "51O3A"
}
}
}
}
}
},
sortable: false,
filterable: false,
<c:if test="${editT_readF}">
editable: {
confirmation: false
},
toolbar: [{name: "create", text: "<spring:message code='button.create'/>"}],
</c:if>
columns: [
{
field: "obmedzenie",
title: "<spring:message code='opatrenia'/>",
template: "#=obmedzenie.nazov#",
editor: zoznamDropDownEditor
},
{
field: "poznamka",
title: "<spring:message code='poznamka'/>"
},
<c:if test="${editT_readF}">
{command: "destroy", title: " ", width: "135px"}
</c:if>
]});

 

function zoznamDropDownEditor(container, options) {
$('<input data-text-field="nazov" data-value-field="kod" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
dataSource: {
transport: {
read: {
url: "<c:url value="/api/pripad/zoznam/obmedzeni" />",
serverFiltering: true,
cache: false
}
},group: { field: "nazovSkupiny" }
},
filter: "contains",
dataTextField: "nazov",
dataValueField: "kod"
});
}

 

I forgot something? An attribute?

 

Thank you.

Nikolay Rusev
Telerik team
 answered on 08 Jul 2015
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?