Telerik Forums
Kendo UI for jQuery Forum
2 answers
419 views
How do I enable sorting on a grid when using a row template.

For example I took the "Row Template" demo and added "sortable: true", but this did not work.  Is there an additional step I am missing?

Here is what I tried:

<script>
                $(document).ready(function () {
                    $("#netflixTable").kendoGrid({
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            filter: [{
                                field: "Name",
                                operator: "contains",
                                value: "Star Wars"
                            }, {
                                field: "BoxArt.SmallUrl",
                                operator: "neq",
                                value: null
                            }],
                            transport: {
                                read: "http://odata.netflix.com/Catalog/Titles"
                            }
                        },
                        sortable: true,
                        rowTemplate: kendo.template($("#rowTemplate").html()),
                        height: 200
                    });
                });
            </script>


Less important: how can I add the alternating row backgrounde effect when using a row template?
Kjell
Top achievements
Rank 1
 answered on 24 Apr 2012
8 answers
503 views
For some weird reason the select event is not fired when i click on the results. Did the following :
 var autoComplete = $("#autoComplete").kendoAutoComplete({
  dataTextField: "name",
select : function(e) { console.log(e); }
...

});
but no joy. Also, i tried binding it afterwards like it suggests on the manual but nothing.
Finally i did the following : 

 autoComplete.popup.element.bind("click", function(e) {
   var index = $(e.currentTarget).index();
   var dataItem = autoComplete.dataSource.view()[index];
    
   console.log(dataItem);
});

but this is a hack job and i would much rather not use it
Brandon
Telerik team
 answered on 24 Apr 2012
1 answer
152 views
Hello,

I found out two bugs in kendo slider,
The first one is when you enable an slider which is enable the slider become crazy. When you go up and after go down two or three times, Slider does what it wants. You have to do sometimes a lot of clicks, sometimes a few clicks, but normally you have a click and it increase the value slider and that is not a good behavior.

The second one is when a slider is disable and you want to move the "circle" (drag and drop to change value slider) that raise too many errors.

<input id="slider" class="balSlider" />
            <script>
 
            $(document).ready(function(){
                $("#slider").kendoSlider({
                                increaseButtonTitle: "Right",
                                decreaseButtonTitle: "Left",
                                min: 0,
                                max: 10,
                                value: 1,
                                smallStep: 1,
                                largeStep: 1,
                                tickPlacement:"both"
                            }).data("kendoSlider");
 
                var slider = $("#slider").data("kendoSlider");
 
                slider.enable();
            });
 
 
            </script>
Hristo Germanov
Telerik team
 answered on 24 Apr 2012
0 answers
167 views
I got this "string" column first_name, which seems to be validated (it doesn't even have a validation rule specified) in a grid.
When i open the edit popup and change it's value, i get a validation message: "first_name is not valid date"..
This does not happen if i remove the column birthdate or set it's type to be "string"...
In fact.. if i fill a valid date into first_name, and some random string into birthdate, it doesn't complain anymore.. so it seems that even tho birthdate is displayed as a datepicker, it tries to validate first_name.
This also only happens when the editable attribute is set to 'popup' and works with inline editing.
I am pretty amazed at how this can be possible. please help!!!

Code:
$(document).ready(function () {
    var crudServiceBaseUrl = '/participant',
    dataSource = source,
        batch: true,
        pageSize: 30,
        schema: {
            model: {
                id: "id",
                fields: {"id":{"editable":false,"type":"number","label":"ID"},"first_name":{"type":"string","label":"First Name"},"last_name":{"type":"string","label":"Last Name"},"birthdate":{"type":"date","label":"Birthdate"},"social_security_number":{"type":"string","label":"Social Security Number"},"smoker":{"type":"boolean","label":"Smoker"},"vegetarian":{"type":"boolean","label":"Vegetarian"},"miscelaneous":{"type":"string","label":"Miscelaneous"},"active":{"type":"boolean","label":"Active"},"blacklist_comment":{"type":"string","label":"Blacklist Comment"}}            }
        }
    });
 
    $("#grid").kendoGrid({
        dataSource: dataSource,
        width: 1000,
        toolbar: ["create"],
        columns: [{"title":"ID","field":"id"},{"title":"First Name","field":"first_name"},{"title":"Last Name","field":"last_name"},{"title":"Birthdate","field":"birthdate"},{"title":"Social Security Number","field":"social_security_number"},{"title":"Smoker","field":"smoker"},{"title":"Vegetarian","field":"vegetarian"},{"title":"Miscelaneous","field":"miscelaneous"},{"title":"Active","field":"active"},{"title":"Blacklist Comment","field":"blacklist_comment"},{"command":"destroy","filterable":false},{"command":"edit","filterable":false}],
        editable: "popup",
        selectable: "row",
        pageable: true,
        sortable: true,
        groupable: true,
        filterable: true,
    });
});
GungFooMon
Top achievements
Rank 1
 asked on 24 Apr 2012
0 answers
129 views
Hello,

I want to create a grid with a hierarchy. I have clients who have differents missions.
I want to class by mission (number) and have informations about this mission. Informations are in my function "Tableau" and return on json list and contains the mission code.
I pass in parameters a which is a list which contains the missions (differents numbers missions).


function createGridMission(a)
{
 
    var element = $("#gridF01").kendoGrid({
                    dataSource: {
                            data: a,
 
                        pageSize: 6,
                        serverPaging: true,
                        serverSorting: true
                    },
                    height: 450,
                    sortable: true,
                    pageable: true,
                    detailInit: detailInit,
 
                    columns: [
                        {
                            field: "mission",
                            title: "Mission"
                        }
                             ]
                });
 
 
            function detailInit(e) {
                $("<div/>").appendTo(e.detailCell).kendoGrid({
                    dataSource: {
                        transport: {
                            read: {
                                url: "/Mob/Client/Tableau?mission=" + a + "&id=" + $("#hidCodeClient").val(),
                                dataType: "json"
                            }
                        },
                        serverPaging: true,
                        serverSorting: true,
                        serverFiltering: true,
                        pageSize:6,
                        filter: { field: "mission", operator: "eq", value: e.data.mission }
                    },
                    scrollable: false,
                    sortable: true,
                    pageable: true,
                    columns: [
                            { field:"periode", title:"Période" },
                            { field:"debut", title:"Début" },
                            { field:"fin", title:"Fin" },
                            { field: "quantite", title:"Quantité" },
                            { field:"production", title:"Production" },
                            { field:"facturation", title:"Facturation" },
                            { field:"solde", title:"Solde" },
                            { field:"dateSolde", title:"Date solde" }
                        ]
                });
 
    }
 
}
Florian
Top achievements
Rank 1
 asked on 24 Apr 2012
1 answer
216 views
I apologize in advance if this is not the correct part of the forum to post this in.

We have a WCF service running on a server accessible from the internet (which we already use for other things).

Our current idea is to create a small mobile app using Kendo.  The app would call one of the WCF methods to fill in a "list" (e.g. a list of fruits, etc).

As I understand it, Kendo uses html5/css and javascript.  So I guess the question is are we able to do this using kendo?  Have a mobile app call a WCF method (assume for now it has internet access, we will add a check for that later on) and take the returned data to display on the app/page?

Thank you in advance for the information
Alexander Valchev
Telerik team
 answered on 24 Apr 2012
0 answers
261 views
<ul>
                    <li>Competitor:
                        <%-- <input id="titles" />--%>
                        <select id="CompProducts" class="km-text">
                        </select></li>
                    <li runat="server">Series:
                        <select id="iLevel" class="km-text">
                        </select>
                    </li>
                    <li runat="server">
                        <label for="depth">
                            Depth:</label>
                        <select id="depth">
                        </select>
                    </li>
                </ul>
 <script type="text/javascript">
        var Container = '';
        var returnVal = '';
        var myArray2 = new Array();
        var myArray = new Array();
        var myArray3 = new Array();

        function GetAllUserInfo() {
            var Surl = "LPService.asmx/ListCompetitorProducts";
            $.ajax({
                url: Surl,
                type: 'POST',           
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    returnVal = result.d;
                    Container = [{ text: "--Select--"}];
                    myArray.push(Container[0]);

                    for (i = 0; i <= returnVal.length - 1; ) {
                        Container = [{ text: "" + returnVal[i], value: "" + returnVal[i]}];
                        myArray.push(Container[0]);
                        i = i + 1;
                    }
                    Init();
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    returnVal = '';
                    alert(textStatus);
                }
            });
        }
   
        function Init() {
            
           $("#CompProducts").kendoDropDownList({
                dataTextField: "text",
                dataValueField: "value",
                dataSource: myArray,
                change: onManfacturerChange
            });
        };
        var val = '';
        var id = '';

        function onManfacturerChange() {
            var va = this.value();           
            myArray2 = [];
            val = $("#CompProducts").val();           
            var dataString = "{'Manufacturer':'" + val + "'}";         
            var Surl = "LPService.asmx/ListCompetitorSeries";
            $.ajax({
                url: Surl,
                type: 'POST',
                data: dataString,
               contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    returnVal = result.d;
                    var arr = returnVal;                 
                    Container = [{ text: "--Select--"}];
                   myArray2.push(Container[0]);
                    for (i = 0; i <= arr.length - 1; i++) {
                        var Cont = [{ text: "" + arr[i], value: " " + arr[i]}];
                        myArray2.push(Cont[0]);                      
                    }
                    CompSeries();                 
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    returnVal = '';
                    alert(textStatus);
                }
            });
   }
  
        function CompSeries() {  
             
           $("#iLevel").kendoDropDownList({
                    dataTextField: "text",
                    dataValueField: "value",
                    dataSource: myArray2,
                    change: onChangeCompSeries
                });
        };     

        var val = '';
        var id = '';
        function onChangeCompSeries() {           
            myArray2 = [];
            val = $("#iLevel").val();
            var dataString = "{'SeriesType':'" + val + "'}";      
            var Surl = "LPService.asmx/ListDepth";
            $.ajax({
                url: Surl,
                type: 'POST',
                data: dataString,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    returnVal = result.d;
                    var arr = returnVal;               
                   Container = [{ text: "--Select--"}];
                    myArray2.push(Container[0]);
                    for (i = 0; i <= arr.length - 1; i++) {
                        var Cont = [{ text: "" + arr[i], value: " " + arr[i]}];
                        myArray2.push(Cont[0]);                     
                    }
                    Depth();
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    returnVal = '';
                    alert(textStatus);
                }
            });
        }
   
        function Depth() {         
            $("#depth").kendoDropDownList({ 
                dataTextField: "text",
                dataValueField: "value",
                dataSource: myArray2,
                change: onChangedepth
            });
        };
        var val1 = '';
        var id1 = '';
        function onChangedepth() {
            myArray3 = [];
            val1 = $("#depth").val() + '"';        
            var dataString = "{'DepthType':'" + val1 + "'}";      
            var Surl = "LPService.asmx/Depth";
            $.ajax({
                url: Surl,
                type: 'POST',
                data: dataString,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    returnVal = result.d;
                    var arr = returnVal;                
                    Container = [{ text: "--Select--"}];
                    myArray3.push(Container[0]);
                    for (i = 0; i <= arr.length - 1; i++) {
                        var Cont = [{ text: "" + arr[i], value: " " + arr[i]}];
                        myArray3.push(Cont[0]);                  
                    }
                    LpSeries();
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    returnVal = '';
                    alert(textStatus);
                }
            });
        }  
        function LpSeries() {         
            $("#dropdown").kendoDropDownList({
                dataTextField: "text",
                dataValueField: "value",
                dataSource: myArray3
            });
        };
    </script>


Every time when i select first dropdown, the second dropdown will bound upon the selected value in 1st dropdown.It was okey when i select 1st time but if i changed the 1st dropdown value again then the 2nd one will disappear.How to resolve this?   
Tirumalesh
Top achievements
Rank 1
 asked on 24 Apr 2012
2 answers
133 views
The following pages have broken links on them.
http://www.kendoui.com/documentation/ui-widgets/menu/overview.aspx
http://demos.kendoui.com/web/menu/api.html

The link that is broken is "Menu API demos"

Sara
Georgi Krustev
Telerik team
 answered on 24 Apr 2012
0 answers
164 views
Hi!

I am trying to define an initial value for an ajax datasource populated dropdownlist in an editor definition function for a grid column.
I have tried setting it via the text() function after initialization but it seems to get "changed" to index 0 as soon as the datasource is bound to the widget..
I also tried using a callback for the select() function, setting a value() as well as using the text() method both right after the initialization (which seems to get overwritten upon loading the data) and inside a "change" even handler for the transport attribute of the datasource; none of which helped.. please advise!

here a snippet of code i used:

"editor":
    function(container, options) {
      $('<input id="' + options.field + '" />')
          .appendTo(container)
          .kendoDropDownList({
                dataTextField: 'text',
                dataValueField: 'value',
 
                dataSource: {
                    change: function(e) {
                        var item = null;
                        $('#'+options.field).data('kendoDropDownList').ul.children().each(function(idx, elem) {
                            if($(elem).html() == options.model.rel_type) item = $(elem);
                        });
                        console.log($(item).html());
// does not select anything even tho console.log() proves that it is the correct element
                        $('#'+options.field).data('kendoDropDownList').select($(item));
                    },
                    transport: {
                        read:  {
                            url: '/relationdata/relation/relType',
                            dataType: 'json'
                        }
                    }
 
                }
          });
    }}

the grid loads fine but nothing is selected in turn.
GungFooMon
Top achievements
Rank 1
 asked on 24 Apr 2012
3 answers
537 views

Hi, We are using the following code but not able to populate the Grid. Our Json is in the form of string . the json structure is something like this. "d : [{"ID":"1","Name":"Umesh"}]"

$(document).ready(

 

function () {

 

$(

 

"#customergriddiv").kendoGrid
({
height: 400,
pageable:
true,
scrollable:
false,
sortable:
true,
columns: [{ field:
"ID", title: "ID" }, { field: "Name", title: "Name"}],
datasource: {
transport: {
read: {
type:
"POST",
url:
"GetJson.asmx/GetCustomers",
contentType:
'application/json; charset=utf-8',
dataType:
"json"
}

 

},
schema: {
data:

 

"d"
}
, pageSize: 10
}
});
 });

<

 

 

div id="customergriddiv"></div>

 

Luis
Top achievements
Rank 1
 answered on 24 Apr 2012
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
MultiColumnComboBox
Dialog
Chat
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
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
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?