Telerik Forums
Kendo UI for jQuery Forum
2 answers
940 views

Hi I'm new to kendo ui, recently had created a table using kendo grid and my data shown [object Object] the cell. 

what is the way to display the address object in a single data.

<!DOCTYPE html>
<html>
<head>
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.default.mobile.min.css" />
 
    <script src="//kendo.cdn.telerik.com/2016.2.714/js/jquery.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.2.714/js/kendo.all.min.js"></script>
</head>
<body>
        <div id="example">
            <div id="grid"></div>
               
          <script>
  
        var peoples = {
            "people": [{
        "name": "John Smith",
        "phone": "(519) 420-2391",
        "address": {
            "street": "123 Main St",
            "city": "Someplace"
        }
    }]
};
             
 
             
   $("#grid").kendoGrid({
    dataSource: {
        data: peoples,
        schema: {
            data: 'people'
        },
       
    },
     scrollable: true,
     sortable: true,
     resizable: true,
     pageable: true,
     columnMenu: true,
      
    columns: peoples
});
          </script>
             
        </div>
 
 
</body>
</html>

Austin
Top achievements
Rank 1
 answered on 13 Sep 2016
11 answers
3.1K+ views
I've been trying out the grid and have a small sample project that is returning data from a db and placing it into a Grid.  The problem is that the grid is setting the element height for the k-grid-content to 4px or 0px and I'm not sure why.  I'm using the stock MVC3 project template and have added what I think are all the kendo scripts and javascript to my project.

So when the javascript runs to populate the grid, it writes an element.style to the k-grid-content and it's always too short like:

<div class="k-grid-content" style="height: 4px;">

If I go into firebug and remove the style, my grid shows all the data, but i'm not sure why it's adding the style attrbitute.

My javascript is also setting a height on the grid and the headers show up fine.

I don't know if this matters, but I grabbed Kendo using NuGet. 

I also noticed that you have a kendo.kendo.min.css, but no corresponding Content\Kendo folder.  I tried using the style and it gave 404 errors for gradient and another file.
Dimo
Telerik team
 answered on 12 Sep 2016
3 answers
372 views
It seems that the current implementation of Kendo's TreeList drag and drop allows for moving a node from one parent to another but does NOT allow for moving the order in which siblings appear. What are my options for doing this? I need a hierarchical grid with additional columns - that's why I chose TreeList. I also need the ability to move items around in the tree.
Stefan
Telerik team
 answered on 12 Sep 2016
1 answer
204 views

http://demos.telerik.com/kendo-ui/treelist/editing

 

How to add a new Row under a selected node. Not able to select a row in demo above. It always adds a new row at the top. I am using Chrome.

 

Thanks

Nikolay Rusev
Telerik team
 answered on 12 Sep 2016
5 answers
366 views

Hi All,

I'm very new to this community and started to use the trial version of Kendo UI on Friday last week. I was asked by my Head of Department to test the functionalities of Kendo UI to see if it would be interesting to buy for the developers team (me included). As the main use of it would be in SharePoint web part and application pages, I used the JS / HTML 5 version and tried to get pieces of information on the documentation and on Internet, I followed this tutorial even if it does not exactly match my needs on Code Project - Kendo UI in SharePoint Online to display the items of a list in a grid.

With the tutorial, I manage to get a working grid using the provided url for the data source. I tried to adapt the code to retrieve the items of the list I want to display in the current SharePoint Site Collection (which is on premises, not online), but now, each time the grid launches the request for the data source, it keeps prompting me for credentials despite the fact that the data is available on the same site as the page being executed. Even so, if I provided the credentials manually, it only ask again for credentials endlessly without displaying anything.

Can you help me with that ?

Maybe the best is that I show you the code I currently have :

The headers :

<link href="/_layouts/15/MyTools/styles/kendo.common-office365.min.css" type="text/css" rel="stylesheet" />
<link href="/_layouts/15/MyTools/styles/kendo.office365.min.css" type="text/css" rel="stylesheet" />
<script src="/_layouts/15/MyTools/js/jquery-2.2.1.min.js" type="text/javascript"></script>
<script src="/_layouts/15/MyTools/js/kendo.all.min.js" type="text/javascript"></script>

 

The code itself :

$(document).ready(function () {
    var appWebUrl = _spPageContextInfo.webAbsoluteUrl;
    var listToDisplay = "<%= GetListToDisplay() %>";
    var dataSource = new kendo.data.DataSource({
        schema: {
            model: {
                fields: {
                    ID: { type: "number" },
                    Title: { type: "string" },
                    Author: { type: "string" },
                    Created: { type: "date" },
                    Editor: { type: "string" },
                    Modified: { type: "date" }
                }
            },
            data: function (data) {
                return data.d && data.d.results ? data.d.results : [data.d];
            },
            errors: function (response) {
                return response.error;
            }
        },
        transport: {
            read: {
                url: appWebUrl + "/_api/lists/getbytitle('" + listToDisplay + "')/items",
                headers: {
                    "accept": "application/json; odata=verbose"
                }
            }
        },
        pageSize: 20
    });
    $("#grid").kendoGrid({
        dataSource: dataSource,
        height: 550,
        groupable: false,
        sortable: true,
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5
        },
        columns: [ {
            field: "ID",
            title: "ID"
        }, {
            field: "Title",
            title: "Title",
            width: 240
        }, {
            field: "Author",
            title: "Created By"
        }, {
            field: "Created",
            title: "Created"
        }, {
            field: "Editor",
            title: "Modified By"
        }, {
            field: "Modified",
            title: "Modified"
        }]
    });
});

 

 

 

Did I do something wrong or have I missed something while setting up the grid ?

Thank you in advance for your help,

 

Best Regards,

Kevin

Kevin
Top achievements
Rank 1
 answered on 12 Sep 2016
1 answer
101 views

Hello,

I'm using the Benchmark demo to create my application.

The demo is shifting the data because the interval limit.

Is it possible for not shifting the data so that we can pan the previous data when it stop?

 

 

T. Tsonev
Telerik team
 answered on 10 Sep 2016
1 answer
363 views

I'm trying to set up a TreeView. My json data from the server has IDs and Parent IDs that contain what the hierarchy is. Root levels have parentId of "NULL". Can I not specify my hierarchy self-referentially like this? Do I HAVE to make an "items: []" sub-structure in my JSON for each parent node?

 

var ds = new kendo.data.HierarchicalDataSource({
            transport: {
                read: function(e) {
                    //JSON is returned here. Example [{id: 50, parentId: "NULL", name: "abc"}, {id: 51, parentId: 50, name: "xyz"}]
                }
            },
            schema: {
                model: {
                    id: "id",
                    parentId: "parentId",
                    fields: {
                        id: { type: "number" },
                        parentId: { type: "number", defaultValue: 0 }
                    }
                }
            }
        });

 

Dimiter Topalov
Telerik team
 answered on 10 Sep 2016
7 answers
871 views
I am trying to bind my kendo treeview to a sql self referencing table that stores the data needed to represent a multi-level hierarchy of treeview items. I am attaching a picture of my sql table as well as a screen shot of how my treeview is currently displaying this data, and certain items are being duplicated, and I can't determine why. Below is the code for my controller and view.  Pretty sure my table structure is correct, but I'm thinking the query is adding the children nodes a 2nd time but as parent items, so maybe the controller needs to filter out the items that don't have null as the parent ID as it's binding the parent nodes... If anyone can help I'd be very grateful!!!

Controller
    public class NavigationMenuItemController : Controller
    {
        private symphonyappEntities db = new symphonyappEntities();

        // GET: /NavigationMenuItem/
        public ActionResult Index()
        {
            var navigationmenuitems = db.NavigationMenuItems.Include(n => n.NavigationMenuItem1).Include(n => n.NavigationMenu);
            return PartialView("~/Views/Shared/_NavigationBarPartial.cshtml", navigationmenuitems);
        }

        [ChildActionOnly]
        public ActionResult NavBarPartial()
        {
            var navigationmenuitems =
                db.NavigationMenuItems.Include(n => n.NavigationMenuItem1).Include(n => n.NavigationMenu);
            return PartialView("~/Views/Shared/_NavigationBarPartial.cshtml", navigationmenuitems);
        }
}

View
        @(Html.Kendo().TreeView()
                  .Name("treeview")
                  .HtmlAttributes(new { style = "width:200px;" })
                  .Events(events => events
                .Select("onSelect"))
            .BindTo(Model, mappings =>
                  {
                mappings.For<NavigationMenuItem>(binding => binding
                    .ItemDataBound((item, menuItem) =>
                          {
                        item.Text = menuItem.MenuItemText;
                        item.Id = menuItem.MenuItemURL;
                    })

                    .Children(menuItem => menuItem.NavigationMenuItems1));

            mappings.For<NavigationMenuItem>(binding => binding
                    .ItemDataBound((item, submenuitem) =>
                                  {
                        item.Text = submenuitem.MenuItemText;
                        item.Id = submenuitem.MenuItemURL;
                    }));

                  })
        
        )


Dimiter Topalov
Telerik team
 answered on 10 Sep 2016
1 answer
417 views

I am using the HTML wrapper for the ListView in MVC.  I give the ListView a datasource to an Odata service.  I am using a template to display the items in the ListView.  When the page first loads and service returns the data the templates are rendered on the bind.   However, when I attempt to query the data source the template is not rendered.  The call to my OData service succeeds and data is returned as confirmed in the Developer Tools, and loading spinner is displayed over the control while the query is executing.

The idea here is that I will call the query on a button click so that I can apply filters.  

Thanks

 

Template:

<script type="text/x-kendo-tmpl" id="resultsViewTemplate">
    <div class="col-md-6">
        <div class="thumbnail">
            <h2>
                #:Name#
            </h2>
            <div class="result-item location">
                <h3>Location:</h3>
                <p>#:Floor#</p>
                <p>#:StreetAddress#</p>
                <p>#:City#, #:State# #:ZipCode#</p>
            </div>
            <div class="result-item restrictions">
                <h3>Restrictions:</h3>
                <p></p>
                <p></p>
            </div>
            <div class="result-item amenities">
                <h3>Amenities</h3>
            </div>
        </div>
    </div>
</script>

 

Query:

$("#update").on("click", function(e) {
    $("#resultsListView").data().kendoListView.dataSource.query();
});

 

Configuration of the ListView:

@(Html.Kendo().ListView<ResourceViewModel>()
    .TagName("div")
    .ClientTemplateId("resultsViewTemplate")
    .AutoBind(true)
    .DataSource( ds => ds
        .Custom()
        .Type("odata-v4")
        .Transport( tp => tp
            .Read( read => read
                .Url($"/api/vm/Resources/Models.GetAvailable")
            )
        )
        .PageSize(6)
        .ServerPaging(true)
        .ServerSorting(true)
    )
    .Name("resultsListView")
)

 

 

Dimiter Topalov
Telerik team
 answered on 10 Sep 2016
4 answers
799 views

Hi,

the click event is not fired if the button is togleable:

<body>
        <div id="example">
            <div class="demo-section k-content wide">
                <div id="toolbar"></div>
            </div>
            <script>               
                $(document).ready(function() {
                    $("#toolbar").kendoToolBar({
                        items: [
                            { type: "button", text: "Button",click: onclick  },
                            { type: "button", text: "Toggle Button", togglable: true, click: onclick  },
                          ]});
                });
               
              function onclick(e) {
                alert(e.target.context.innerText);
              }
            </script>
        </div>
</body>
Dojo

Is there an other event to catch the state changed?

Peter

Ianko
Telerik team
 answered on 10 Sep 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
ScrollView
Switch
TextArea
BulletChart
Licensing
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
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?