Telerik Forums
Kendo UI for jQuery Forum
1 answer
539 views
 Hi,

I'm migrating a project from ASP.NET MVC Extensions to KendoUI. I'm trying to figure out the best way to re-create this grid binding using KendoUI and without any serverside code. I can't find anything to do with onRowDataBound or similar in the documentation.

As you can see, as each row is databound, it attaches the countdown jquery plugin (http://keith-wood.name/countdown.html) and uses the current dataItem's Due datetime value.

Is the only way to do this using javascript inside the <script id="rowTemplate" type="text/x-kendo-tmpl"> element?

How can I recreate this to work with KendoUI?
function onRowDataBound(e) {
 
     e.row.cells[2].innerHTML = "<span class='countdown-" + e.dataItem.SONumber + "'></span>"
 
     if (e.dataItem.Due != null && e.dataItem.Due < new Date(2015, 4, 1) && e.dataItem.Due > new Date(2011, 4, 1)) {
         $('.countdown-' + e.dataItem.SONumber).countdown({
             until: new Date(Date.parse(e.dataItem.Due)), compact: true,
             layout: '<strong>{dn} {dl} {hnn}{sep}{mnn}{sep}{snn}</strong>',
         });
     }
 
 
 }

This is sample output for one row once it has been rendered:
<tr style="background: none repeat scroll 0% 0% rgb(255, 134, 112);">
   <td>43475</td>
   <td>New</td>
      <td>
         <span class="countdown-43475 hasCountdown">
            <strong>0 d 00:00:00</strong>
         </span>
      </td>
   <td>Account</td>
   <td>Description</td>
   <td>Cons</td>
   <td class="t-last">P3 - 24H</td>
</tr>
Thanks
RGTech
Top achievements
Rank 1
 answered on 01 Apr 2013
2 answers
157 views
When I have a ModalView open and change the orientation of my iPad, the ModalView is no longer centered.  How do I get it to re-center? I assume I need to bind on the orientationchange event, but I don't know what code I can use to re-center.

     $(window).bind('orientationchange', reCenter);

     function reCenter() {
          // unknown recenter code??
     }

Thank you,
Jason
Jason
Top achievements
Rank 1
 answered on 30 Mar 2013
3 answers
198 views
For a specific reason I'd like to use my kendo mobile app also through desktop browser (webkit). Is there a way to enable mouse wheel scrolling of my views?
Yrjo
Top achievements
Rank 1
 answered on 30 Mar 2013
1 answer
132 views
Are you planning to support sliders and pickers in KendUI Mobile anytime soon? Is there any workaround or any good third party widget you use to add a slider range? I tried with <input type="number">, but it's ugly.

Thanks for the information.
Iliana Dyankova
Telerik team
 answered on 29 Mar 2013
1 answer
249 views
Hello all,

I am trying the detail template today and I have the detail template for my parent grid (pasted below).   The CustomerNumber is coming from the parent grid and I am getting my read result set just fine.  The issue is the parameters I need such as "DocID" you will below are coming up undefined.   Those params are in the model for the template I have DocumentModel.   How do I pass those params from the detail template model versus the parent model?

<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("tabStrip_#=CustomerNumber#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Attachments").Content(@<text>
@(Html.Kendo().Grid<ABC.DataModel.Document.DocumentModel>()
.Name("grid_#=CustomerNumber#")
.Columns(columns =>
{
columns.Bound(p => p.DocumentType).Width(40).Title("Type").ClientTemplate("#=RenderImage(data)#");
columns.Bound(p => p.DocumentName).ClientTemplate(@Html.ActionLink("#=DocumentName#", "DownloadFile",
new { ID = "#=DocID#", fileRef = "#=FileRef#", fileName = "#=DocumentNameExt#" }).ToHtmlString());
columns.Bound(p => p.ModifiedDate).Title("Modified");
columns.Bound(p => p.ModifiedBy).Title("Modified By");
columns.Bound(p => p.LatestVersion).Title("Latest Version");
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("CustomerAttachments_Read", "Customer", new { library = "#=CustomerNumber#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate())
</text>
);
})
.ToClientTemplate())
</script>
Sean Bornstein
Top achievements
Rank 1
 answered on 29 Mar 2013
3 answers
546 views
Thank you all in advance for your assistance. I am new to Kendo and trying to work my way through some event examples. I have two questions.

For my scenario I have an array of items that I am binding to a treeview. Each data item looks like this...
[{"id": 24820, "parentId": 0, "title": "Kendo", "target": "_blank", "href": "http://www.kendoui.com", "active": true, "hasChildren": false}, ...]

Questions #1: Can I access data elements of a node on a select event?

Question #2: Is there a way to cancel page change onSelect? e.preventDefault() does not seem to work for me.

I am trying to use the data above and onSelect determine if the "target" is set to "_blank". If it is, I want to execute an open new window and prevent the current page from changing. If not, I want the normal logic to run.

Sample Code:
<div id="menu" class="k-content">
    <div id="treeview"></div>
</div>
<script type="text/javascript">
    var data = new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                url: "api/menu",
                type: "GET",
                dataType: "json",
                contentType: "application/json"
            }
        },
        schema: {
            model: {
                id: "id",
            }
        }
    });
 
    function onSelect(e) {
        var targetIsBlank = false;
        // TODO: Check e.node passed and determine if "target" is "_blank"
        if (targetIsBlank) {
            // TODO: open new window with target and href properties
            e.preventDefault(); // this doesn't work when dataUrlField is set
        }
    }
 
    $("#treeview").kendoTreeView({
        dataSource: data,
        dataTextField: "title",
        dataUrlField : "href",
        select: onSelect,
    });
</script>
zhao
Top achievements
Rank 1
 answered on 29 Mar 2013
8 answers
197 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
113 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
732 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
364 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
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
Drag and Drop
Application
Map
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
DropDownTree
ListBox
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
Styling
ColorPicker
Pager
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
Licensing
PivotGridV2
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
LLM Kit
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?