Telerik Forums
Kendo UI for jQuery Forum
3 answers
2.6K+ views
Hi, 
I must be missing something.
if I have a treeview and I have a select event handler bound to it, I can inspect the currently selected node's text by saying e.node.text(). However, if I try to get the text of the parent node, i.e. e.node.parent().text(), I get a string with all the node's text concatenated together. All I want is a simple node.getParent function that returns the exact same object as e.node only it's parent. If the node has no parent (i.e. it s a root), then it should return null. This seems harder than it should be.
Is there a way to do this or am I missing something?
Thanks ... Ed
Alex Gyoshev
Telerik team
 answered on 15 Aug 2013
5 answers
1.3K+ views
I am attempting to update the listview datasource but have not been having any luck. I had it working creating the kendoMobileListView in my javascript but I am trying to avoid defining the ul #listView as a kendoMobileListView in my javascript.

<ul id="listView" data-role="listview" data-source="siteDataSource" data-template="sitesListViewTemplate"></ul>

function (ko, system, SiteDataCachingService, $) {
        var homeViewModel = function () {
        var self = this;
        self.siteDataSource = null;
        
        self.init = function (e) {
            self.siteDataSource = new kendo.data.DataSource({data: SiteDataCachingService.sites});
            $("#listView").data("kendoMobileListView").dataSource.read();
        }

        return self;
    }

    return homeViewModel;
}

What am I doing wrong when updating my dataSource that is causing it not to update?

Petyo
Telerik team
 answered on 15 Aug 2013
4 answers
95 views
Hi,

I'm getting an error when I have a an ODATA DataSource with a transport that has Create defined. Here is a JSFiddle showing the error.  It doesn't matter what the URL is set to, it never reaches the point of using it. If you open the console you will see the error.

http://jsfiddle.net/cpomer/qmX55/6/

Any help would be appreciated.

Thanks,
Chris
Kiril Nikolov
Telerik team
 answered on 15 Aug 2013
2 answers
143 views
I'm evaluating Kendo web to use in hosting CRUD functionality in a DNN razor module - connecting to jsonp data.  I'm doing my initial page tests using an ASP.Net Web Site (Razor v2), but will port to a DNN razor module after the proof-of-concept.  I've written a jsonp Get() webservice and have successfully displayed the results in a KendoUI grid.  Now I am trying to display a composite column in the grid, populated with a concatenation of multiple data elements (Name: first, middle, last) using the schema parse function. So far, I haven't succeeded, and when I debug the Javascript in Firefox, it appears that the parse function isn't being called.
Any help would be appreciated.  Using the code below, the grid displays and is populated with data for all columns except the ContactName column.

@{
    Layout = "~/_SiteLayout.cshtml";
    Page.Title = "ServiceProvidersAgencyContacts";
}

<h2>ServiceProvidersAgencyContacts</h2>

@section Styles{
    <link href="~/Kendo/2013.2.716/Styles/kendo.common.min.css" rel="stylesheet" />
    <link href="~/Kendo/2013.2.716/Styles/kendo.default.min.css" rel="stylesheet" />
}

<div id="example" class="k-content">
    <div id="grid"></div>
</div>

@section Scripts{
    <script src="~/kendo/2013.2.716/Scripts/kendo.web.min.js"></script>
    <script id="rowTemplate" type="text/x-kendo-tmpl">
        <tr>
            <td class="contactName">
                <span class="description">Name : #: LasttName#, #: First Name#</span>
                <span class="title">#: Title #</span>
            </td>
        </tr>
    </script>
    <script>
        $(document).ready(function() {
            $("#grid").kendoGrid({
                dataSource: {
                    transport: {
                        read: {
                            url: "http://CSDWebServices/ServiceProvidersRestWS/agencycontacts/60001",
                            dataType: "jsonp"
                        }
                    },
                    schema: {
                        model: {
                            id: "Id",
                            fields: {
                                Id: { type: "number" },
                                AgencyCode: { type: "string" },
                                FirstName: { type: "string" },
                                MiddleName: { type: "string" },
                                LastName: { type: "string" },
                                Suffix: { type: "string" },
                                TitleId: { type: "number" },
                                Email: { type: "string" },
                                Phone: { type: "string" },
                                IsContactEnergy: { type: "Boolean" },
                                IsContactCSBG: { type: "Boolean" },
                                Title: { type: "string" },
                                ContactName: { type: "string" }
                            },
                            parse: function (data) {
                                $each(data.items, function (index, value) {
                                    item.value.ContactName = kendo.format("{1} {2} {3} {4}",
                                        value.FirstName,
                                        value.MiddleName,
                                        value.LastName,
                                        value.Suffix);
                                });
                                return data;
                            }
                        }
                    },
                    pageSize: 20,
                    serverPaging: false,
                    serverFiltering: true,
                    serverSorting: false
                },
                height: 430,
                filterable: true,
                sortable: true,
                pageable: true,
                columns: [
                    {
                        field: "ContactName",
                        title: "Contact Name",
                        width: 30
                    }, {
                        field: "FirstName",
                        title: "First Name",
                        width: 10
                    }, {
                        field: "LastName",
                        title: "Last Name",
                        width: 10
                    }, {
                        field: "Suffix",
                        title: "Suffix",
                        width: 10
                    }, {
                        field: "Email",
                        title: "Email",
                        width: 10
                    }, {
                        field: "Phone",
                        title: "Phone",
                        width: 10
                    }
                ]
            });
        });
    </script>
}
Mark
Top achievements
Rank 1
 answered on 15 Aug 2013
1 answer
91 views
I have simple chart on the page. I added dropdownlist to filter the chart. I chrome the dropdown won't expand. In IE 10.  the dropdown will expand only if I click on the text only. I copied the example form the demo and pasted on the same page and it didn't work. when I removed the chart it worked fine.
   
@(Html.Kendo().DropDownList()
.Name("color")
.DataTextField("Text")
.DataValueField("Value")
.Events(e => e.Change("change"))
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "Black",
Value = "1"
},
new SelectListItem() {
Text = "Orange",
Value = "2"
},
new SelectListItem() {
Text = "Grey",
Value = "3"
}
})
.Value("1")
)
Sharif
Top achievements
Rank 1
 answered on 14 Aug 2013
1 answer
86 views
I am trying to put together a page using HTML5/Kendo UI, and have a treeview defined.  I actually had this working with a call to a data page, but now have added a WFC service to provide the data.  The DATA appears to be making it to the page, as evidenced by the data showing up in the console (see initializeTreeView method below).  HOWEVER...the treeview never shows up.  I THINK it is something to do with the binding or definition of the datasource, but so far 1 and 1/2 days of research and trying different things has not gotten me anywhere...I am hoping someone here can spot my problem.
THE HTML: <div id="treeviewLeft"></div>
 
THE CONTROLLER CODE:
    // Get Treeview data from database; ABL & nonABL   
    var mySpecSheetData = new SpecSheetData();
    mySpecSheetData.GetTreeviewNodes('170', successFunction, failureFunction);
 
        function successFunction()
        {
            $('#loadingIndicator').remove();
             
            intializeTreeView();
        }
 
        function failureFunction()
        {
            console.log("********** ERROR **********");
        }
     
        function intializeTreeView()
        {
            var specData = new kendo.data.HierarchicalDataSource();
            specData = mySpecSheetData.GetTreeviewData();
 
            console.log(JSON.stringify(specData, null, 1));
            alert("Get TreeviewNodeData Success!");
 
            var treeView = $("#treeviewLeft").kendoTreeView({
                autoBind: false,
                expanded: true,               
                datasource: specData,
                dataTextField: 'displayName'              
            }).data("kendoTreeView");
        }
 
THE MODEL CODE:
function SpecSheetData() {
    var treeNodes = [];
}
 
SpecSheetData.prototype.GetTreeviewNodes = function (repNumber, successFunction, failureFunction) {
    var that = this;
 
    $.ajax({
        //Call for data goes here
        type: 'GET',
        url: 'SGLibraryDataService.svc/GetTreeviewDataByRepNum',
        data: { RepNumber: repNumber },
        dataType: 'json',
        async: true,
        success: function (returnedTreeNodeData) {
            that.treeNodes = returnedTreeNodeData;
            successFunction();
        },
        failure: function (e) {
            failureFunction();
        }
    });
 
}
 
SpecSheetData.prototype.GetTreeviewData = function ()
{
    return this.treeNodes;
}
Rich
Top achievements
Rank 1
 answered on 14 Aug 2013
1 answer
139 views
Hi

Currently I have a multi-series line chart using the following data:

{
    "series": [{
        "name": "Incident",
        "data": [21, 16, 41, 6]
    }, {
        "name": "Change",
        "data": [7, 6, 2, 0]
    }],
    "categories": ["/Date(1367391600000-0700)/", "/Date(1370070000000-0700)/", "/Date(1372662000000-0700)/", "/Date(1375340400000-0700)/"],
    "trendCategories": [],
    "KendoChartType": "line",
    "LineWidth": 3,
    "TooltipDateFormat": "MMM yyyy",
    "categoryAxis_Type": "date"
}
and settings:

series: result.series,
categoryAxis: {
      categories: result.categories,
      majorGridLines: {
          visible: false
      },
      type: "date"
}

What I'm wondering is there a way I can use this data format and settings on the Stock Chart?  The only example of a multi-series stock chart I could find used data items for the points that had a value for each series. 

Thanks
Iliana Dyankova
Telerik team
 answered on 14 Aug 2013
5 answers
123 views
Are there any remote view examples in razor syntax anywhere?  I have not been able to find any and need to get them working.
Brian
Top achievements
Rank 1
 answered on 14 Aug 2013
2 answers
208 views
Hi,

I have been following several examples for the CRUD setup but seems i cannot get it to work.
Below is the code i run -
1. It reads perfectly.
2. It calls the save method
3. It sends the correct data to the update php file.
4. If i take the link with the head data from firebug and paste into the browser it do update the records
5. if i do the update from the grid it gets a 200 ok but nothing is updated in the database.

Where do i go wrong?
First is my html code
Next is my php file for update.

            <div id="example" class="k-content">
            <div id="grid"></div>
 
<divclass="console"></div>
 
            <script>
                $(document).ready(function (options) {
                    var company= '<?php echo $_GET["workingcompany"]; ?>';
                    var crudServiceBaseUrl = "../../data",
                        dataSource = new kendo.data.DataSource({
                            transport: {
                                read:  {
                                    url: "http://www.northpier.org/data/fetchcap.php?company="+company,
                                    dataType: "json"
                                },
 
 
update:  {
 
                                    url: "http://www.northpier.org/data/Updatecap.php?company="+company,
                                    type: "PUT",
                                    dataType: "jsonp"
                       
},
                                destroy: {
                                    url: crudServiceBaseUrl + "/destroy.php",
                                    dataType: "json"
                                },
                                create: {
                                    url: crudServiceBaseUrl + "/create.php",
                                    dataType: "json"
                                },
                                parameterMap: function(options, operation) {
                                    if (operation !== "read" && options.models) {
                                        return {models: kendo.stringify(options.models)};
                                    }
                                }
                            },
                            batch: true,
                            pageSize: 30,
                            schema: {
                                model: {
 
 
                                                id: "id",
 
                                    fields: {
                                        id: { type: "string", editable: false },
                                        date_time: { type: "string"},
                                        Name: { type: "string", editable: true },
                                        Common: { type: "number", validation: { required: true, min: 0} },
                                        SeriesA: { type: "number", validation: { required: true, min: 0} },
                                        SeriesB: { type: "number", validation: { required: true, min: 0} },
                                        SeriesC: { type: "number", validation: { required: true, min: 0} },
                                    }
 
 
                                }
                            }
                        });
 
                    $("#grid").kendoGrid({
                        dataSource: dataSource,
 
filterable:true,
 
groupable:true,
 
                        navigatable: true,
                        pageable: true,
                        height: 400,
                        toolbar: ["create", "save", "update", "cancel"],
                        columns: [{
                                field: "Name",
                                title: "Name",
                                editable: true,
                            },
                            {
                                field: "Common",
                                title: "Common",
                            },
                            {
                                field: "SeriesA",
                                title: "Series A",
                            },
                            {
                                field: "SeriesB",
                                title: "Series B",
                            },   
                            {
                                field: "SeriesC",
                                title: "Series C",
                            }],
 
  columnMenu:{
    messages:{
      columns:"Choose columns",
      filter:"Apply filter",
      sortAscending:"Sort (asc)",
      sortDescending:"Sort (desc)"
    }
  },
 
 
                        editable: true,
                       
 
                       change: function() {
                            console.log("change event");
                        },
                        edit: function() {
                            console.log("edit event");
                        },
                        save: function() {
                            console.log("save event");
                        },
                        saveChanges: function() {
                            console.log("saveChanges event");
                              $('#grid').data().kendoGrid.refresh();
                        },
                        remove: function() {
                            console.log("remove event");
                        }
                    });
                });
            </script>
        </div>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'XXXXXXXXXXXXX';
$dbpass = 'XXXXXXXXXXXXXXX';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
  die('Could not connect: ' . mysql_error());
}
parse_str(file_get_contents("php://input"),$post_vars);
$comp = $_GET['company'];
$mod = $_GET['models'];
$request = json_decode($mod);
 
foreach ($request as $product) {
 
$sql = "UPDATE captable
        SET Name='$product->Name',
        Common='$product->Common',
        SeriesA='$product->SeriesA',
        SeriesB='$product->SeriesB',
        SeriesC='$product->SeriesC'
        WHERE id='$product->id'";
 
mysql_select_db('XXXXXXXXXXX');
$retval = mysql_query( $sql, $conn );
 
if(!$retval )
{
  echo "OUCH!";
  //die('Could not update data: ' . mysql_error());
}
else
{
        $result3 = null;
echo $result3;
 
}
}
mysql_close($conn);
 
 
?>
Kiril Nikolov
Telerik team
 answered on 14 Aug 2013
1 answer
44 views
Hi,
I'm using a scroller for displaying readable paragraphs of text.  Right now in the Icenium simulator and on iOS and android clients the scroller shows any left or right aspect of the swipe as a springy left or right animation and then the scroller text recenters.  Is there any way to force a scroller to only scroll up and down and ignore any left/right info in the swipe so that the scroller doesn't feel loosely attached to the rest of the UI?

Thanks,
Dave
Alexander Valchev
Telerik team
 answered on 14 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?