Telerik Forums
Kendo UI for jQuery Forum
3 answers
226 views

Why does Bounds() always return 1 pixel more than the actual width and height?

Check out: http://dojo.telerik.com/@Harold@/Ivacu

var shape = new kendo.dataviz.diagram.Shape({ type: "rectangle", x: 0, y: 0, width: 1150, height: 1150, fill: "blue" });
    
alert("bounds().width = " + shape.bounds().width);

Result:

bounds().width = 1151

Tsvetina
Telerik team
 answered on 10 Apr 2017
1 answer
265 views

Hello,

I would like to use a ComBobox without loading the entire option's list. The ComboBox must also be filterable.

I tested 2 approaches:
- In MVC, I did not find the Virtual attribute MapValueTo dataItem and it crashes to the loading
- In JS, it crashes when the selected value is not in loaded options

Where am I wrong?

 

Controller:

public class ContactController
{
    var Manager = new ContactManager();
        public virtual ActionResult _List([DataSourceRequest] DataSourceRequest request)
        {
            var result = Manager
                .Enables()
                .UseAsDataSource()
                .For<ContactListViewModel>()
                .OrderBy(p => p.Fullname);
            return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
        public virtual ActionResult _Get(int? id)
        {
            var result = new List<ContactListViewModel>();
            if (id.HasValue)
            {
                var model = Manager.Find(id);
                result.Add(Mapper.Map<ContactListViewModel>(model));
            }
            return Json(result, JsonRequestBehavior.AllowGet);
        }
}

 

Razor version:

@(Html.Kendo().ComboBoxFor(model => model)
    .Name(propertyName)
    .DataTextField("Fullname")
    .DataValueField("ContactId")
    .Placeholder(" ")
    .HtmlAttributes(editorHtmlAttributes)
    .Filter("contains")
    .Height(200)
    .DataSource(dataSource => dataSource.Custom()
        .ServerFiltering(true)
        .ServerPaging(true)
        .PageSize(80)
        .Type("aspnetmvc-ajax")
        .Transport(transport =>
        {
            transport.Read("_List", "Contact");
        })
        .Schema(schema =>
        {
            schema
                .Errors("Errors")
                .Data("Data")
                .Total("Total");
        })
    )
    .Virtual(v => v.ItemHeight(26).ValueMapper("contactValueMapper"))
)
<script>
    function contactValueMapper(options) {
        $.ajax({
            url: "@Url.Action("_Get", "Contact")",
            data: { id: options.value },
            success: function (dataItems) {
                options.success(dataItems);
            }
        });
    }
</script>

Error onload:

Uncaught TypeError: Cannot read property 'length' of undefined
    at kendo.all.js:7288
    at Object.n.success (kendo.all.js:5583)
    at fire (jquery-1.10.2.js:3062)
    at Object.fireWith [as resolveWith] (jquery-1.10.2.js:3174)
    at done (jquery-1.10.2.js:8249)
    at XMLHttpRequest.callback (jquery-1.10.2.js:8792)

 

JavaScript version:

<input id="@propertyName" name="@propertyName" value="@(Model.HasValue ? Model.ToString() : "")" />
 
<script>
    function contactValueMapper(options) {
        $.ajax({
            url: "@Url.Action("_Get", "Home", new { area = "Contact" })",
            data: { id: options.value },
            success: function (dataItems) {
                options.success(dataItems);
            }
        });
    }
 
    $(function () {
 
        $("#ContactProfileId").kendoComboBox({
            "dataSource": {
                "type": "aspnetmvc-ajax",
                "transport": {
                    "read": {
                        "url": "@Url.Action("_List", "Home", new { area = "Contact" })"
                    }
                },
                "pageSize": 80,
                "page": 0,
                "total": 0,
                "serverPaging": true,
                "serverFiltering": true,
                "filter": [],
                "schema": {
                    "data": "Data",
                    "total": "Total",
                    "errors": "Errors"
                }
            },
            "dataTextField": "Fullname",
            "filter": "contains",
            "height": 200,
            "virtual": {
                "mapValueTo": "dataItem",
                "valueMapper": contactValueMapper,
                "itemHeight": 26
            },
            "dataValueField": "ContactProfileId",
            "placeholder": ""
        });
    });
</script>

Error

Uncaught TypeError: Cannot read property 'index' of undefined
    at init._getElementByDataItem (kendo.all.js:80207)
    at init._deselect (kendo.all.js:80554)
    at init.select (kendo.all.js:80144)
    at init._select (kendo.all.js:32418)
    at init._click (kendo.all.js:32579)
    at init.proxy (jquery-1.10.2.js:841)
    at init.trigger (kendo.all.js:124)
    at init._clickHandler (kendo.all.js:80686)
    at HTMLLIElement.proxy (jquery-1.10.2.js:841)
    at HTMLUListElement.dispatch (jquery-1.10.2.js:5109)

 

Thank you for your answer
Nencho
Telerik team
 answered on 10 Apr 2017
1 answer
453 views

http://dojo.telerik.com/iZope/2

 

Using the above dojo filter the grid to Feb 10, 2016 and click "delete me".  The data in the grid disappears.  Why?  If you clear the filters then the data appears.

Our requirement is to use a json data object which is set to the datasource and allow the user to use the grid filters as well as external buttons that get new data, set it on the datasource and refresh the datasource.  All of this works fine until they use the grid filters then any refresh causes the grid to be blank.

 

Thanks for any help you can give.

Jason
Top achievements
Rank 1
 answered on 10 Apr 2017
1 answer
464 views

I used kendoui Grid and external filter using input box for search keyword.

I want to apply some style(ex. color: blue) to keywords in cells of kendoUI grid filtered by keyword in input box.

    var q = iptManagerSearch.val(); // keyword value by user input
    var grid = gridManagerUI.data("kendoGrid");
    grid.dataSource.filter({
        // page: 1,
        // pageSize: 20,
        logic: "or",
        filters: [ // fields to be applied keyword from users input
            {field:"ums_groups_name", operator:"contains", value:q},
            {field:"name", operator:"contains", value:q},
            {field:"id", operator:"contains", value:q},
            {field:"organization", operator:"contains", value:q},
            {field:"position", operator:"contains", value:q},
            {field:"responsibility", operator:"contains", value:q},
            {field:"mobilePhoneNumber", operator:"contains", value:q},
            {field:"lastLogin", operator:"contains", value:q},
            {field:"lastEntry", operator:"contains", value:q}
        ]
    });

 

I did filter my grid by user's input.

after that I want to make all keywords( that matched with user's input keyword ) in each cell has 'color: blue'

 

How can I access style of keywords  in cells of filtered grid. In case of my code, value is 'q'.

 

Thanks

Viktor Tachev
Telerik team
 answered on 10 Apr 2017
2 answers
331 views

I've implemented a DropDownList in a custom editor for a Grid column as follows.

                    $("#control").kendoGrid({
                        dataSource: controlDs,
                        editable: true,
                        saveChanges: function (e) {
                            if (!confirm("Are you sure you wish to save changes?")) {
                                e.preventDefault();
                            }
                        },
                        toolbar: ["save","cancel"],
                        sortable: true,
                        columns: [
                                {
                                    title: "Artifacts",
                                    headerAttributes: {
                                        style: "font-size: 10pt; font-weight: 600; text-align: center;"
                                    },
                                    columns: [
                                        {
                                            field: "family",
                                            editor: customDropDownEditor,
                                            headerAttributes: {
                                                style: "font-size: 10pt; font-weight: 600;"
                                            },
                                            title: "Family",
                                            width: 120
                                        },
                                        {
                                            field: "artifact",
                                            editable: function (dataItem) {
                                                return false;
                                            },
                                            headerAttributes: {
                                                style: "font-size: 10pt; font-weight: 600;"
                                            },
                                            title: "Artifact",
                                            template: '<a href="#=artifact#" target="_blank">#=title#</a>'
                                        }
                                    ]
                                }
                            ]
                    });

                function customDropDownEditor(container, options) {
                    $('<input required name="' + options.field + '"/>')
                        .appendTo(container)
                        .kendoDropDownList({
                            autoBind: false,
                            dataSource: ["one", "two", "three", "four"]
                        });
                }

This works perfectly. Now, how do I attach a ToolTip widget to the items in this DropDownList?

Thanks in advance.

Ianko
Telerik team
 answered on 10 Apr 2017
4 answers
961 views

I am wondering if it is possible to group resources vertically that are not part of the scheduler resources... 

I saw that I can specify 'group: {orientation: 'vertical', resources: ['OwnerName']}' in my timeline view that I want this displayed this way in, which utilizes the 'text' field of all the javascript objects in my resource named 'OwnerName', which is the resource list that is set to my scheduler resources option.

 

However, my scheduler resources have items that I don't want shown on my timeline grouping (like groups and various rooms). I only want the users from the list, so tried creating a new resource item and setting my group:{resources: newResource} but nothing happened.

 

How can I apply vertical grouping of resources, but use a custom resource item that is not the resources of the scheduler?

Nencho
Telerik team
 answered on 10 Apr 2017
7 answers
829 views
I would like to change page size of DataSource depends on my needs. However when I'm setting:
DataSource.pageSize(10);
it is causing that data is read from server.

I would like to prevent such behaviour and read data from server only on read method, how to achieve that?

Similar issue is with page method. From time to time it causes read with initial settings so it reads data twice. with diferent params. when I comment out DataSource.page(1); everthing is working.

I also realize that this is happening if there is no data when I calling this methods. If there is data there is no read action.
Alex Hajigeorgieva
Telerik team
 answered on 10 Apr 2017
2 answers
334 views

When the user clicks in a certain column, we make it into a dropdown (using range.validation(String here). We have to do this because there are over 10,000 rows and adding different validations to each takes too long.

However - we also have an onchange method, which fires when this dropdown (validation) is added as technically the cell value has changed (from the original value, to the new value which is the same as the original, but part of a validation). Is there any way to stop this event firing? Thanks!

Marc
Top achievements
Rank 1
 answered on 10 Apr 2017
1 answer
86 views

Hello,
I'm displaying start and end dates in the RangeBar chart.

I'm setting min and max range in the valueAxis as seen here:

valueAxis: {
        min: new Date("2017/04/06 07:00").getTime(),
        max: new Date("2017/04/06 17:00").getTime(),
        majorUnit: 60 * 60 * 1000, // 60 minutes in milliseconds
    labels: {
        template: "#= kendo.toString(new Date(value), 'HH:mm') #"
        }
    },

 

The problem I'm having is getTime() is returning the number of milliseconds since Epoch off by 4 hours.

In the example above, GetTime() returns 1491476400000, or "2017/04/06 11:00" instead of "2017/04/06 07:00"

The label is displaying 07:00.

I'm assuming this is some kind of UTC issue?  I live in the EDT timezone which is UTC-4 hours.
How do I need to do to have getTime() return the proper milliseconds?

Regards,

 

David

 

Daniel
Telerik team
 answered on 10 Apr 2017
2 answers
127 views
I have quite a bit of views available for the user to switch between, making this view bar quite long, and it will create a second line in the header before collapsing. I want it to collapse at screen width 1635px so it can stay neatly on one line. However, I cannot find anywhere on how you adjust when the view bar collapses.
Tyler
Top achievements
Rank 1
 answered on 07 Apr 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?