Telerik Forums
Kendo UI for jQuery Forum
0 answers
194 views
Hi,

I am looking to a MCV example for kendo Grid where I can have Paging Sorting and Filtering on server side.
I have implemented the filtering option on server side in my code Here is my Code

/// On Server 
public class GridCommand
    {
        public FilterExpression Filter { get; set; }       
    }


    public class FilterExpression
    {
        public string Logic { get; set; }
        public IEnumerable<GridFilter> Filters { get; set; }
    }


    public class GridFilter
    {
        public string Operator { get; set; }
        public string Field { get; set; }
        public string Value { get; set; }
    }

public ActionResult GetContracts(GridCommand command)
        {
//Some Code
            return Json(list, JsonRequestBehavior.AllowGet);            
        }


////On Client
$("#grid").kendoGrid({
                        dataSource: {
                            type: "jsonp",
                            transport: {
                                read: {
                                    url: "/Test/GetContracts"
                                },
                                parameterMap: function(options) {                       
                 var result = {};
                 if (options.filter) {
                     result["filter.logic"] = options.filter.logic;
                     var filters = options.filter.filters;
 
                     for (var idx = 0, length = filters.length; idx < length; idx++) {                               
                         result["filter.filters[" + idx + "].operator"] = filters[idx].operator;
                         result["filter.filters[" + idx + "].field"] = filters[idx].field;
                         result["filter.filters[" + idx + "].value"] = filters[idx].value;                               
                     }                          
                 }                       
                 return result;
             }
         
                            },
                            schema: {
                                model: {
                                    fields: {
                                        AccountName: { type: "string" },
                                    AccountNumber: { type: "string" },
                                        ContractName: { type: "string" },
                                        ContractNumber: { type: "string" },
                                        ContractProductType: { type: "string" }
                                    }
                                }
                            },
                            pageSize: 10,
                            serverPaging: true,
                            serverFiltering: true,
                            serverSorting: true
                        },
                        filterable: true,                                               
                        pageable: true,
                        height: 400,                        
                        columns: [
                            { field: "AccountName", title: "Account Name", width: 150 },
                            { field: "AccountNumber", title: "Account Number", width: 150 },
                            { field: "ContractName", title: "ContractName", width: 150 },
                            { field: "ContractNumber", title: "Contract Number", width: 100 }
                        ]
                    });
                });

All I want when any action perfor in grid like sorting,Filtering or paging my "GridCommand command" have that option on server.

How can I modify  parameterMap: function(options) {    } function to send all option on server in GridCommand .



Anilesh
Top achievements
Rank 1
 asked on 02 May 2012
0 answers
150 views
Is Kendo UI compatible with salesforce..???
Vishnu
Top achievements
Rank 1
 asked on 02 May 2012
10 answers
1.7K+ views
I have the need to use a third-party widget (https://github.com/harvesthq/chosen/) in a data template but am unsure of how to instantiate it. It basically wraps a multi-select element, which is simple enough, but I need this auto-generated from my view model.

In Knockout, there's an "afterRender" event that I can use to call into my view model, passing the newly created HTML elements. Does anything like this exist in Kendo's MVVM framework?

For most of the Kendo widgets, I seem to be able to use the data-role attribute to handle widget creation.

Thanks
Mark
Top achievements
Rank 1
 answered on 02 May 2012
1 answer
299 views
Is there a way to change the validation on a field in the datasource after the datasource has been bound to a grid?

These two approaches don't work although I see the properties get updated.

var datasource = $("#customers").data("kendoGrid").dataSource;
datasource.options.schema.model.fields.Forename.validation = { required: false };
datasource.options.schema.model.fields.Surname.validation.required = false;
 
$("#customers").data("kendoGrid").refresh();
Iliana Dyankova
Telerik team
 answered on 02 May 2012
0 answers
156 views
I've added a PanelBar to a view and have it working.  However, I am unable to get this panel bar to fill all available space, without hard codin pixel values, instead of just being as large as content within.

<head>
    <title></title>
    <script src="kendoui.mobile.2012.1.406.commercial/js/jquery.min.js" type="text/javascript"></script>
    <script src="kendoui.mobile.2012.1.406.commercial/js/kendo.mobile.min.js" type="text/javascript"></script>
    <script src="kendoui.web.2012.1.322.commercial/js/kendo.panelbar.min.js" type="text/javascript"></script>
    <link href="kendoui.web.2012.1.322.commercial/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="kendoui.web.2012.1.322.commercial/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
    <link href="kendoui.mobile.2012.1.406.commercial/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div data-role="view" data-title="Views">
    <header data-role="header">
        <div data-role="navbar">
            <span data-role="view-title"></span>
            <a data-align="right" data-role="button" class="nav-button" href="#index">Index</a>
        </div>
    </header>
    <ul id="panelBar">
    <li>
        Item 1
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
        </ul>
    </li>
    <li>
        Item 2
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
        </ul>
    </li>
</ul>
</div>
<script>
    var app = new kendo.mobile.Application(document.body);
    $(document).ready(function () {
        $("#panelBar").kendoPanelBar();
    });
</script>
</body>
</html>
Benjamin
Top achievements
Rank 1
 asked on 02 May 2012
1 answer
143 views
Hello, I am trying to get the Hello World example from http://www.kendoui.com/documentation/mobile/application/overview.aspx to work in a Visual Studio 2010 ASP.NET project.

i created a new aspx page called 'Mobile.aspx' and included all the Kendo js files and Scripts.
I tried to "aspify" the Hello World example, but when I run it via F5 (and it is displayed in Chrome) I just see the content from the default Site.master page, and just the text
Header
Hello world!
Footer
in the content area.  I see nothing that looks like a Kendo mobile app.

Here is my attempt at "aspification" of the Hello World app.  The Intellisense doesn't like the 'data-role' attribute, but I suspect my problems are much more basic.
--------------------------------------------------------------
<%@ Page  Title="Mobile" MasterPageFile="~/Site.master" Language="C#" AutoEventWireup="true" CodeFile="Mobile.aspx.cs"
    Inherits="Mobile" %>

<asp:Content ID="HeadContent" runat="server" ContentPlaceHolderID="HeadContent">
    <title>Kendo Mobile Test</title>
    <!-- Kendo UI Web styles-->
    <link href="styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
    <!-- Kendo UI Web scripts-->
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/kendo.dataviz.min.js" type="text/javascript"></script>-->
    <script src="content/console.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

   <div data-role="view">
     <div data-role="header">Header</div>
     Hello world!
     <div data-role="footer">Footer</div>
   </div>

   <script type="text/javascript" src="js/kendo.mobile.application.min.js">
       var app = new kendo.mobile.Application(); //document.body is used by default
   </script>

</asp:Content>
--------------------------------------------------------------

Thank you,
Tim
Tim
Top achievements
Rank 1
 answered on 02 May 2012
13 answers
1.6K+ views
Sample jsFiddle here: http://jsfiddle.net/latenightcoder/R4mKu/3/ 

Try selecting a new option and then canceling when the confirm dialog pops up. (This sets it back to the old value using the value method). Now, try selecting a new option and the change event doesn't trigger.
Richard
Top achievements
Rank 1
 answered on 02 May 2012
8 answers
721 views
Hi,

I am trying to load a different page on the first,second, and third tab when a drop down list selected item changes.I followed the solution at (http://www.kendoui.com/forums/ui/tabstrip/change-url-of-tab-content.aspx) but the code does not seem to work.

<script type="text/javascript">
$(function () {
  $("#AlliancesSummaryFormModel_CodeShare").change(function () {
$($('#timelineTabStrip').find('a.k-link')[0]).data('contentUrl', '/AlliancesPerformancePortal/Flown/AlliancesSummary/Q/2015/1/All/AED');
 
            });
        });
 
    </script>

The find method return value evaluates to an object which means it not null, but the call to .data('contentUrl',url) does not load the new URL content.

Thanks

Madani
Kamen Bundev
Telerik team
 answered on 02 May 2012
1 answer
136 views
Hi
Do you have any suggestions or best-practices for internationalization of the column names in the Kendo Grid?

I thought of creating a RESTservice that would give a JSON mapping for the language in question.

/Thomas
Alexander Valchev
Telerik team
 answered on 02 May 2012
1 answer
230 views
Hi,
I'm using the grid with the popup editor. All is well but when I click the update button the grid doesn't call the update url given to my datasource. I have the latest 2012.1.322 version of kendo. Is there a specific configuration I need to give to my grid for this to work?!!

        gridContainer
        .kendoGrid({
            dataSource : dataSource,
            pageable : false,
            height : 400,
            sortable : true,
            toolbar : [ "create" ],
                            columns : [
                    {
                        field : "firstName",
                        title : "First Name"
                    },
                    {
                        field : "lastName",
                        title : "Last Name"
                    },
                    {
                        field : "email",
                        title : "Email"
                    },
                    {
                        field : "status",
                        title : "Status",
                        editor : statusEditor
                    },
                    {
                        field : "telephone",
                        title : "Telephone"
                    },
                    {
                        field : "jobTitle",
                        title : "Job"
                    },
                    {
                        field : "newsSubscription",
                        title : "Subscribe to news?"
                    } ],
            editable : "popup"
        });
 
        var grid = gridContainer.data("kendoGrid");
    }
     
     
});
 
 
function createDataSource(readUrl, updateUrl, destroyUrl, createUrl){
    return new kendo.data.DataSource({
        transport : {
            read : {
                url : readUrl,
                dataType : "json"
            },
            update : {
                url : updateUrl,
                dataType : "json"
            },
            destroy : {
                url : destroyUrl,
                dataType : "json"
            },
            create : {
                url : createUrl,
                dataType : "json"
            },
            parameterMap : function(options, operation) {
                debugger;
                if (operation !== "read" && options.models) {
                    return {
                        models : kendo.stringify(options.models)
                    };
                }
            }
        },
        batch : true,
        pageSize : 30,
        schema : {
            model : {
                id : "id",
                fields : {
                    firstName : {
                        validation : {
                            required : true
                        }
                    },
                    lastName : {
                        validation : {
                            required : true
                        }
                    },
                    email : {
                        validation : {
                            required : true
                        }
                    },
                    telephone : {
                        validation : {
                            required : false
                        }
                    },
                    jobTitle : {
                        validation : {
                            required : false
                        }
                    },
                    newsSubscription : {
                        validation : {
                            required : false
                        },
                        type : "boolean"
                    },
                    status : {
                        validation : {
                            required : false
                        },
                        type : "text"
                    }
 
                }
            },
            data : function(data) {
                return data.users;
            }
        }
    });
}

Thank you,
Valanto
Iliana Dyankova
Telerik team
 answered on 02 May 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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
ScrollView
Switch
BulletChart
Licensing
QRCode
ResponsivePanel
TextArea
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?