Telerik Forums
Kendo UI for jQuery Forum
2 answers
91 views
Good day to you all.

I am developing an icenium app in which I get data from an SQL Server. Now I do want to split this data into three different views and display them with different initial sorting.

Kind of 

name   age    height    weight
Joe           33       180cm     80 kg
Jane         28       170cm    50 kg
Baby         1            50cm   9 kg


View 1 Grid with
name  age

View 2 Grid with
name height

View 3 Grid with
Name  weight

I have two problems

1) the initial sorting does only work with the give code below for the first view I load
2) sorting works only on the first view I sort.

Any advice. Should I make 3 different API calls or can it be handled dynamicly


Markus

<!-- Gemeinden  Steuerfüsse-->
 <div data-role="view" id="view-gemeinden-steuerfuesse" data-init="getGemeindeDaten('SteuerfussTotal')" data-layout="drawer-layout-gemeinden" data-title="Steuerfüsse" >
<div data-role="content" class="view-content" >
<div id="grid-gemeinden-steuerfuesse"></div>
</div>
</div>
         <!-- Gemeinden  Einwohner-->
 
        <div data-role="view" id="view-gemeinden-einwohner" data-init="getGemeindeDaten('Einwohner')" data-layout="drawer-layout-gemeinden" data-title="Einwohnerzahlen" >
<div data-role="content" class="view-content" >
<div id="grid-gemeinden-einwohner"></div>
</div>
</div>
         
         <!-- Gemeinden  Ausländeranetiel-->
 
        <div data-role="view" id="view-gemeinden-auslaender" data-init="getGemeindeDaten('Auslaenderanteil')" data-layout="drawer-layout-gemeinden" data-title="Ausländeranteil" >
<div data-role="content" class="view-content" >
<div id="grid-gemeinden-auslaender"></div>
</div>
</div>


function getGemeindeDaten(sortBy) {
    var dataSource = new kendo.data.DataSource({
        type: "json",
        transport: {
            read: {
                url: "http://mobile.mydomain.com/api/t_gemeindens/GetSteuerfuesse",
                data:{
                    Accept: "application/json"
                }
            }
        },
           
        sort: {field: sortBy, dir: "asc"},
    });
 
    $("#grid-gemeinden-steuerfuesse").kendoGrid({
        dataSource: dataSource,
        sortable: true,
               columns: [
            {
                field: "Gemeinde",
                title: "Gemeinde",
                width: 150,
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                field: "SteuerfussJahr",
                title: "  Jahr",
                width: 90,
                 
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                field: "SteuerfussTotal",
                title: "Total",
                width: 90
            }
            , {
                template: "<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>",
                title: "Quelle"
            }
         
        ]
          
    });
    $("#grid-gemeinden-einwohner").kendoGrid({
        dataSource: dataSource,
        sortable: true,
        columns: [
            {
                field: "Gemeinde",
                title: "Gemeinde",
                width: 150,
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                field: "Einwohner",
                title: "Einwohner",
                width: 90,
                 attributes: {
       
                    style: "text-align: left;k font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }
            , {
                template: "<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>",
                title: "Quelle"
            }
         
        ]
          
    });
    $("#grid-gemeinden-auslaender").kendoGrid({
        dataSource: dataSource,
        sortable: true,
              columns: [
            {
                field: "Gemeinde",
                title: "Gemeinde",
                width: 120,
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                template: "#=Auslaenderanteil# %",
                 field: "Auslaenderanteil",
                title: "2012",
                width: 70,
                 attributes: {
       
                    style: "text-align: right; font-size: 0.8em;padding-right:10px;"
                },
                  headerAttributes: {
       
                   style: "text-align: right; font-size: 1em;padding-right:10px;"
                }
            }
            , {
                template: "<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank'  style='font-size:0.8em;'>Quelle</a>",
                title: "Quelle",
                 
                 attributes: {
       
                    style: "text-align: right; font-size: 0.8em;padding-right:10px;"
                },
                  headerAttributes: {
       
                   style: "text-align: right; font-size: 1em;padding-right:10px;"
                }
            }
         
        ]
          
    });








Markus
Top achievements
Rank 2
 answered on 17 Dec 2013
1 answer
282 views
Hello, Kendo Team
  I'm studying Kendo UI Mobile data binding features and has a problem,when define a parse function for  kendo.data.Model  in "fields" section,the function has not triggered when create a new instance of the Model.
var Person = kendo.data.Model.define({
    fields: {
        name: {
            editable: true,
            from:"name",
            parse:function(v){
               console.log('parse name..., v=' + v);
               return v;
            }
        },
        age:{
        type:"number"
        }
    }
});
 
 
 
var person = new Person( {
    name: "John Doe",
    age: 42
});
In above code,the parse function is not triggered when create a new Person.
My question is:
How about he parse function works, any advices for parse function usage?
Atanas Korchev
Telerik team
 answered on 17 Dec 2013
5 answers
285 views
Hello,
I'm trying to add sorting to a DataSource, which generally is working just fine. The only problem is that it seems the sort mode is case sensitive.

If you check out this Fiddle: http://jsfiddle.net/EaNm4/ 
You will see what I mean. ('Alphy' is at the beginning of the list, while 'alpha' is at the end of the list). Is there a way I can specify my own sort algorithm or a way to make the default one case insensitive? I've checked the docs but I'm having a hard time finding anything.
Atanas Korchev
Telerik team
 answered on 17 Dec 2013
10 answers
648 views
Hi, I wrote kendo Grid control in javascript application; I had needed implement server-side grouping, but I couldn't turn it on eventually. Server sorting, and filtering already works, perhaps I am doing something wrong in a render-control-code; here it is:

01.jQuery(ORDER_GRID_ID).kendoGrid({
02.                "change": XX.OrderGrid_Change,
03.                "columns": [{
04.                    "title": XX.Title,
05.                    "width": "120px",
06.                    "field": "number",
07.                    "filterable": true,
08.                    "encoded": true
09.                },
10.                {
11.                    "title": XX.Title1,
12.                    "width": "200px",
13.                    "field": "status",
14.                    "filterable": true,
15.                    "encoded": true
16.                },
17.                {
18.                    "title": XX.Title2,
19.                    "width": "100px",
20.                    "field": "orderDate",
21.                    "format": "{0: yyyy/MM/dd}",
22.                    "filterable": true,
23.                    "encoded": true
24.                },
25.                {
26.                    "title": XX.Title3,
27.                    "width": "100px",
28.                    "field": "deliveryDate",
29.                    "format": "{0: yyyy/MM/dd}",
30.                    "filterable": true,
31.                    "encoded": true
32.                },
33.                {
34.                    "title": XX.Title4,
35.                    "width": "200px",
36.                    "field": "customer.userName",
37.                    "filterable": true,
38.                    "encoded": true
39.                },
40.                {
41.                    "title": XX.Title5,
42.                    "template": "#=totalRequested()# EUR",
43.                    "field": "totalRequested()",
44.                    "filterable": true,
45.                    "encoded": true
46.                }],
47.                "groupable": true,
48.                "pageable": {
49.                    "input": true,
50.                    "refresh": true,
51.                    "pageSizes": [2, 5, 10, 100],
52.                    "buttonCount": 10
53.                },
54.                "scrollable": {
55.                    "virtual": true
56.                },
57.                "sortable": true,
58.                "selectable": "Single, Row",
59.                "toolbar": [{
60.                    "template": '...here is an HTML with toolbar; nothing valuable to solve grouping problem...'
61.                }],
62.                "dataSource": {
63.                    "transport": {
64.                        "read": function (options) {
65.                            getOrders(options);
66.                        },
67.                    },
68.                    "schema": {
69.                        "groups": [{
70.                            "field": "number"
71.                        }],
72.                        "data": "data",
73.                        "total": "total"
74.                    },
75.                    "pageSize": 10,
76.                    "serverPaging": true,
77.                    "serverSorting": true,
78.                    "serverFiltering": true,
79.                    "serverGrouping": true, //why its not working?
80.                    "serverAggregates": true,
81.                    "error": XX.OrderGrid_Error
82.                }
83.            });


When I fire my application, I am trying drag'n'drop column header to "Drop column header here" box, but it seems like this functionality was disabled.

Maybe I am missing some section in kendoGrid constructor, or maybe I wrote some unnecessary data?
Michal
Top achievements
Rank 1
 answered on 17 Dec 2013
4 answers
176 views
When I add grid and dropdownlist control in page, I found the control size is bigger than your demo's. How come that? I attach my screenshot
Troy
Top achievements
Rank 1
 answered on 16 Dec 2013
1 answer
216 views
hey guys
I'm facing the following issue right now:

we use a grid which has a custom toolbar button which runs some function in the background. the code looks like this:

$("#CategorizeNow").click(function categorizing (e) {
        e.preventDefault();
 
        $.ajax({
            url: '@Url.Action("RunAutoCategorization", "Pattern")',
            beforeSend: function() {
                $("#CategorizeNow").addClass("k-state-disabled").html("Categorizing!");
            },
            success: function () {
 
                $("#CategorizeNow").removeClass("k-state-disabled").html("Finished");
                $("#CategorizeNow").kendoTooltip({
                    content: "successfully finished",
                    position: "top",
                    animation: {
                        close: {
                            effects: "fade:out"
                        },
                        open: {
                            effects: "fade:in",
                            duration: 1000
                        }
                    }
                }).show($("#CategorizeNow"));
                 
 
 
            }
 
        });
    });
what we want to achieve is: after the categorize button is clicked it should be disabled first. when the background operation succeeded, the tooltip should be displayed at the top of the categorize now button and the button should get its original state again and be enabled again.

right now the tooltip is only showing if the operation has finished and the mouse enters the button.

any advice would be helpful.

thx in advance and kind regards
thomas
Alexander Popov
Telerik team
 answered on 16 Dec 2013
4 answers
598 views
I`m binding data via Ajax to grid. I added Change event to the grid. what happening is code inside the Onchange event is executing twice .
I have ajax call inside the Change event function , how can I control this ?  My requirement is I should able to write an event that fires at row level like row select event.


 @(Html.Kendo().Grid<User>()
      .Name("grid")
      .DataSource(datasource => datasource
          .Ajax()
          .ServerOperation(false)
          .Model(model => model.Id(p => p.UserID))
          .Read(read => read.Action("AllUserRecords_Read", "User"))
          .PageSize(15)

      )
      .Columns(columns =>
      {
          columns.Bound(p => p.FirstName).Width(40);
          columns.Bound(p => p.LastName).Width(80);
          columns.Bound(p => p.EmailAddress).Width(70);
       })
      .Pageable(pageable => pageable.PreviousNext(true).PageSizes(new[] { 5, 10, 15, 20 }))
      .Filterable()
      .Events(events => events.DataBound("onDataBound").Change("grid_change"))
      .Selectable(select => select.Mode(GridSelectionMode.Single))
      .Resizable(resize => resize.Columns(true))
      .Reorderable(reorder => reorder.Columns(true)))

 function grid_change(e) {
            $.ajax({
                type: "POST",
                url: "/User/GetRoles",
                data: { userID: id },
                async: false,
                success: function (response) {
                    $("#roles").replaceWith(response);
                },
                error: function (response, q, t) {
                    alert(response.responseText);
                }
            });
 function onDataBound(arg) {
        this.element.find('tbody tr:first').addClass('k-state-selected');
}
}
Artsem
Top achievements
Rank 1
 answered on 16 Dec 2013
5 answers
158 views
In WPF RadControls you can pass a function call back to a RadWindow. Can you use a similar approach with Kendo modalView?

WPF Example

this.commandWindowClosing = new RelayCommand<CancelEventArgs>((args) =>
            {
                if (!_closing)
                {
                    args.Cancel = true;
                    RadWindow.Confirm(AppConstConfirmShutdown, this.RequestShutdown);
                }
            });
 
private void RequestShutdown(object sender, WindowClosedEventArgs e)
        {
            try
            {
 
                if (e.DialogResult == true)
                {
                            // Do something
                }
Sorry for posting C# :-)

Is this approach possible with Javascipt and modalView in am mobile app? the samples I've seen don't do this

I know you can override the close event but that doesn't help me, If Kendo implemented Confirm,Alert etc like RadWindow it would be very useful.
Kiril Nikolov
Telerik team
 answered on 16 Dec 2013
4 answers
254 views
I'm not sure if I'm doing something conceptually wrong, but I'd like to use a predefined model and fill it with data form a remote request through DataSource AND the same model inside a view for exposing it's data in HTML.

Right now, I'm doing something like that:
ModelUserProfile: kendo.data.Model.define({
 id: "userId"
,fields: {
 ,firstName: { type: "string" }
 ,lastName: { type: "string" }
        ...
}
});
 
var datasource = new kendo.data.DataSource({
       ...
      schema: {
            model: ModelUserProfile
      },
      ...
});
<div
    id="show-userprofile"
     data-role="view"
     data-model="ModelUserProfile"   
     data-layout
="default"
>
...
</div>
 
<script id="templateUserprofile" type="text/x-kendo-template">
...
   <div data-bind="visible: firstName">Vorname:</div>
...
</script>

As soon as I use the binding inside the view, I'm getting an "Uncaught TypeError: Cannot read property 'get' of undefined" from kendo.mobile.min.js.

Am I doing this wrong (or too complicated?).

As a work-around, I changed it to:
# if (firstName) { # <div>Vorname:</div> # } #
which works fine, but I'd prefer to bind it.

Thanks in advance for any help on this.


Roman
Top achievements
Rank 1
 answered on 16 Dec 2013
3 answers
401 views
I have a Kendo Grid with a column bounded to a enum.  All works fine except when it comes to sorting.  The sorting is performed on the int values of the items, instead of by the text.  i.e.

public enum Test{
    Red = 1,
    Yellow = 2
    Amber = 3
}

Sorting ascending, it outputs: Red, Yellow, Amber.  Instead of Amber, Red, Yellow.
Sorting descending it outputs: Amber, Yellow, Red.  Instead of Yellow, Red, Amber.

How can I get it to sort properly based on the text strings on the left?

Thx!

Mao
Alexander Popov
Telerik team
 answered on 16 Dec 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
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
SPA
Filter
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
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
OrgChart
TextBox
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
Popover
DockManager
FloatingActionButton
TaskBoard
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
TimePicker
DateTimePicker
RadialGauge
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?