Telerik Forums
Kendo UI for jQuery Forum
8 answers
151 views
Is this even possible? Any suggestions? I tried both through a datasource, and with native js + jquery and as soon as elements are added the scroller loses its ability to scroll.

example code below:
an example json file can be found here": https://projects-galcohen.rhcloud.com/shutup/channels.json

 <div id="mypage" data-layout="default" data-role="view" data-init="getScroller">
                Foo2222
            <div class="clearfix" id="channelcontainer" data-role="scroller" ></div>
            </div>
                    
        
        <script id="channeltemplate" type="text/x-kendo-template">
             <div class="img_icon">
                 name:#= name # <br>
                 chan:#= number # <br>
                 priority:#= priority # <br>
                 
             </div>
            
       </script>
            
        <script>
            
            var dataSource = 0; 
            var template = kendo.template($("#channeltemplate").html());
            
            function getScroller(e) {
                alert("HIHIHIH");
                     console.log("MADE IT HERE");
                dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: "channels.json",
                            dataType: "json",
                        }
                    },
                    schema: {
                        data: "channelresults"
                    },
                    change: function() { // subscribe to the CHANGE event of the data source
                        $("#channelcontainer").height(150);
                        $("#channelcontainer").html(kendo.render(template, this.view()));
                        
                    }
                });
            
                dataSource.read();
                var scroller = e.view.scroller;
            }

        </script>
Alexander Valchev
Telerik team
 answered on 29 Mar 2013
10 answers
86 views
it seems that the initScroller function is never being called. If I call it manually, the json file does load and the divs appear, but the outer div loses its Scroller abilities.

Any idea what I might be doing wrong?

<div class="clearfix" id="channelcontainer" data-role="scroller" data-init="initScroller">
                       
</div>

 <script id="channeltemplate" type="text/x-kendo-template">
             <div class="img_icon">
                 name:#= name # <br>
                 chan:#= number # <br>
                 priority:#= priority # <br>
             </div>
       </script>


<script>
            var dataSource = 0; 
            var template = kendo.template($("#channeltemplate").html());
            
            function initScroller(e){
                //alert("hi");
                dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: "channels.json",
                            dataType: "json",
                        }
                    },
                    schema: {
                        data: "channelresults"
                    },
                    change: function() { // subscribe to the CHANGE event of the data source
                        $("#channelcontainer").html(kendo.render(template, this.view()));
                    }
                });
            
                dataSource.read();
                
                var scroller = e.view.scroller;
            }
        </script>
            
        <script>
            var app = new kendo.mobile.Application(document.body);
        </script>


this is the json file: https://projects-galcohen.rhcloud.com/shutup/channels.json
 



Gal
Top achievements
Rank 1
 answered on 29 Mar 2013
2 answers
629 views
I currently have a two step process for my kendo charts. The first process is allowing the user to select the datasets (series) they want on the chart. They then choose a template. A template is the graph settings ex (color theme, chart type line, bar, circle ect.).

Currently if a user selects the datasets they want i return the series information to the graph and the graph is then populated with the template settings.

I also allow the user to change the template settings on the fly. For example a Bar chart to Line, Area, Circle ect. They can also change the theme. The issue becomes when the first load is set, the series information that i pass is:{
[name: "string", data: []],
[name: "string", data: []]
}
when i inspect the series object after the change on the template I see the following added to the object:{
[name: "string",
data: [],
type: "area",
color: "ff6800",
ect...
],
[name: "string",
data: [],
type: "area",
color: "ff6800",
ect...
],
}

The issue becomes that I can modify my object type to the correct selected type. I can even change the color value to a differen color for each series. However, because I am using the Kendo Themes, the chart background will change but then the series colors wont match. I could come up with a function to choose the background color for the chart and then choose what colors you want for your series. But I would rather use the kendo methods if possible.

I also think if i clear out that object and just use the settings and data I am passing it could work. However, I dont want to have to go to the database each time a page level changes is made and I also noticed that my object even if i create a temp object is given all of the chart properties.

Thank you in advance!
don
Top achievements
Rank 1
 answered on 29 Mar 2013
4 answers
318 views
A grid being 'editable' can be set during initialization. Can this be set at runtime as well? I have a 'edit' mode that I would like to use to enable/disable editing of the Grid contents. I see in the documentation that Grid.editable can be set at initialization, but I don't see how it can be changed at runtime (after initialization to use the documentation's terms.)
Ross Micheals
Top achievements
Rank 1
 answered on 29 Mar 2013
2 answers
778 views
When creating a DataSource from an array, I can iterate the strings.
var arr = ["one", "two", "three"];
var datasource = new kendo.data.DataSource({
   data: arr
});
datasource.read();
 
var data1 = datasource.data();
for (var i = 0; i < data1.length; i++) {
   alert(data1[i]);
}
Then I add a new string to the datasource.
datasource.add("four");
var data2 = datasource.data();
for (var i = 0; i < data2.length; i++) {
   alert(data2[i]);
}
As a result, three strings and one object are returned from the datasource.

What should be added, so that the loop returns four strings?

Michael G. Schneider
mgs
Top achievements
Rank 1
 answered on 29 Mar 2013
3 answers
152 views
We have a kendo grid, which has a date field in it.  That date field is sometimes empty.  When kendo sorts ascending (future dates are at the end), the empty fields appear in the front.  Is it possible to change the sort mechanism to make empty dates appear lower in the sort order (near the bottom) rather than higher?
Alexander Valchev
Telerik team
 answered on 29 Mar 2013
1 answer
75 views
I'm trying to accomplish a simple task where upon validation result (failed or passed) I want to perform some action, for example set CSS style to a corresponding text element.  I want to do this per form element. Is there a way to do this? Is there as event that one can subscribe to ,like onValidationComplete(validation_result) ?

Rosen
Telerik team
 answered on 29 Mar 2013
3 answers
76 views
Is it possible to override the code that generates a row in the kendo grid?
I'd like to add more features to the row model's json, without necessarily putting the field in to the model object.

Currently, I'm using a backbone datasource and model to drive my grid.  I'd ideally like to have a callback per model to add this reference.  Is it possible to do?
Alexander Valchev
Telerik team
 answered on 29 Mar 2013
1 answer
177 views
A remote hierarchical data source delivers JSON that looks like the following:  Note the .data property which contains additional information.
jQuery182041788989288830735_1364362919255([
{"id":"6a488457-5b85-48fc-be24-b469219564c4"
,"sprite":"custom3"
,"text":"Silk"
,"hasChildren":true
,"data"
  :{"nodetype":"Fabric"
   ,"level":3
   ,"activity":0
   ,"maintenance":NaN
   ,"status":3
   }
}
,
{"id":"8a9e479a-4448-462e-9151-b1913cc1660e"
,"sprite":"custom3"
,"text":"Wool"
,"hasChildren":true
,"data"
  :{"nodetype":"Fabric"
   ,"level":3
   ,"activity":0
   ,"maintenance":NaN
   ,"status":3
   }
 }
,
{"id":"da373cd1-4264-4096-9955-5527e6c49dd9"
,"sprite":"custom3"
,"text":"Canvas"
,"hasChildren":true
,"data"
  :{"nodetype":"Fabric"
   ,"level":3
   ,"activity":0
   ,"maintenance":NaN
   ,"status":4
   }
}
])

The template in the .kendoTreeView constructor is thus and will display additional status information when the treeview is rendering a 'level 3' node:
window.reportUrl = '/reporter';
window.statusCode = [ 'bla', 'bla', 'bla' ];
 
template:
"<span class='name'>#: item.text #</span>"
+ "# if (item.data.level == 3) {#"
  + "# if (item.hasChildren) {#"
    + " | <a href='#= window.reportURL #?id=#= item.id #' title='View Report' target='_blank'>"
      + "<img alt='View Report' class='cm-icon' src='/images/report.png'>"
    + "</a>"
  + "#}#"
  + "# if (('status' in item.data) && !isNaN(item.data.status)) {#"
    + " | <span class='cs-status'>Status: #= window.statusCode[item.data.status] #</span>"
  + "#}#"
+ "#}#"
My problem is that when a some property .data changes, the tree node is not redrawn.
User does some activity runs a getJSON that returns an updated status for an id.

$.getJSON ( .... )
.done (function (info) {
  // info looks like {result:{id:<some-id>,status:<some-status>}}
 
  var tv = $('#treeview').data('kendoTreeView');
  var dsData = tv.dataSource.get(info.result.id);
   
  dsData.data.set('status', info.result.status); // does not cause node to be redrawn
  dsData.set('data.status', info.result.status); // does not cause node to be redrawn
 
  dsData.set('text', 'BLA BLA BLA'); // DOES cause node to be redrawn
});
What would need to be done to have the treeview observe the 'additional information' in dsData.data (or dsData.data itself) and rerender when something gets set ?

I would prefer to _not_ have to do something like this (untested):
dsData.set('data.status', info.result.status);
dsData.set('text', dsData.text');

Thanks,
Richard
Vladimir Iliev
Telerik team
 answered on 29 Mar 2013
5 answers
822 views
Hi,

I've created a chart in ASP.NET MVC using the following code:
@(Html.Kendo().Chart(Model)
    .Name("Regions")
    .Title("Regions")
        .DataSource(ds =>
            {
                ds.Read(read => read.Action("GetClientRecordsCountByRegion", "Home"));
                ds.Sort(sort => sort.Add(model => model.Region).Ascending());
            }
        )
    .Series(series =>
    {
        series.Pie("TrademarkCount", "Region")
            .Labels(lbl => lbl.Visible(true).Template("#= category #: #= value #")
                .Align(ChartPieLabelsAlign.Circle)
                .Position(ChartPieLabelsPosition.OutsideEnd));
    })
)
On a button click, I would like to refresh the chart with new data by either calling another Action or passing parameters into the current action.  How do I do that?

I tried setDataSource and then redraw as shown below but its not working.  Please help. Thanks!
function refreshsource()
        {
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        type: "GET",
                        url: "/Home/GetClientRecordsCountByRegionNew",
                        dataType: "json"
                    }
                }
            });
 
            var chart = $("#Regions").data("kendoChart");
            chart.setDataSource(dataSource);
            chart.redraw();
        }
Hristo Germanov
Telerik team
 answered on 29 Mar 2013
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?