Telerik Forums
Kendo UI for jQuery Forum
0 answers
146 views
I am new to the Kendo UI so I may not know how best to phrase my question.  I have setup validation for my grid to be used during inline edits.  I would to use this same validation for a user form as well.  No one likes to code the same thing twice.  Any ideas of how I can do that?

My validation for the grid:

var cityCodesModel = {
    id: "CityAlpha",
    fields: {
        CityAlpha: {
            type: "string",
            validation: {
                required: { message: "city alpha code is required" },
                cityAlphacheckLength: function (input) {
                    input.attr("data-cityAlphacheckLength-msg", "a city alpha code must be 3 characters");
                    var ret = true;
                    if (input.is("[name=CityAlpha]")) {
                        ret = input.val().length == 3;
                    }
                    return ret;
                }
            }
        },

        CityNumeric: {
            type: "string",
            validation: {
                required: { message: "city numeric code code is required" },
                cityNumericCheckLength: function (input) {
                    input.attr("data-cityNumericCheckLength-msg", "a city numeric code must be 4 characters");
                    var ret = true;
                    if (input.is("[name=CityNumeric]")) {
                        ret = input.val().length == 4;
                    }
                    return ret;
                },
                cityNumericIsNumeric: function (input) {
                    input.attr("data-cityNumericIsNumeric-msg", "a city numeric code must be numeric");
                    var ret = true;
                    if (input.is("[name=CityNumeric]")) {
                        ret = !isNaN(input.val());
                    }
                    return ret;
                }
            }
        },

        Description: { type: "string",
            validation: {
                required: false,
                descriptionCheckLength: function (input) {
                    input.attr("data-descriptionCheckLength-msg", "a description cannot be longer than 80 characters");
                    var ret = true;
                    if (input.is("[name=Description]")) {
                        ret = input.val().length <= 80;
                    }
                    return ret;
                }
            }
        },
       
        NextFlightEnabled: { type: "boolean" }
    }
};

Brad
Top achievements
Rank 1
 asked on 02 Aug 2012
0 answers
208 views
Hi All,

I am using remote datasource and binding this by using Odata service.

Example for Odata service: 
_WebServiceAddress + "dataapi/ProductGroupProducts?$orderby=Name&$filter=ProductGroupId eq guid'" + tSelectedId + "'"

and i am trying to filter datasource server side by using datasource filter option. 
Example: 

   $("#DivProductGroupDetailsTable").data("kendoGrid").dataSource.filter({
            logic: "or",
            filters: [
                    { field: "Name", operator: "contains", value: pSearchValue },
                    { field: "DataMatchKey", operator: "contains", value: pSearchValue }
                ]
        });

but i am getting following error:
":"Query parameter '$filter' is specified, but it should be specified exactly once."

Please advise.

Thank you in advance.

regards,
Shankar
Shankar
Top achievements
Rank 1
 asked on 02 Aug 2012
7 answers
5.0K+ views
So I've got a Kendo Grid initialized like so:
var custData = {
    "columns": [
        { "field": "ID", "title": "ID", "filterable": true, "width": 1 },
        { "field": "Last", "title": "Last", "filterable": true, "width": 1 },
        { "field": "Middle", "title": "Middle", "filterable": true, "width": 12 },
        { "field": "First", "title": "First", "filterable": true, "width": 1 },
        { "field": "Role", "title": "Role", "filterable": true, "width": 1 },
        { "field": "Rank", "title": "Rank", "filterable": true, "width": 1 }
    ],
    "data": [/* Lots of data here, organized like so: */
        { "ID": "00011", "Last": "Picard", "Middle": "", "First": "Jean Luc", "Role": "Commanding Officer", "Rank": "Captain" }
    ]
};
var custDataSource = new kendo.data.DataSource({
    pageSize: 10,
    data: custData["data"]
});
$("#customers").kendoGrid({
    height: 600,
    width: 800,
    columns: custData["columns"],
    dataSource: custDataSource,
    groupable: true,
    scrollable: false,
    sortable: {
        mode: "multiple",
        allowUnsort: true
    },
    pageable: true,
    selectable: "multiple row",
    nagivatable: true,
    toolbar: [
        { name: "create", text: "New" },
        { name: "save", text: "Save" },
        { name: "cancel", text: "Cancel" },
        { name: "destroy", text: "Delete" }
    ],
    editable: {
        update: true,
        destroy: false,
        confirmation: "Are you sure you want to remove this item?"
    }
});

I'm trying to get a grid with a static height and width. It absolutely must not change height and width when I page (which it currently does, due to variably-sized data). The same is true of the data cells. They absolutely must not change size or shape, but they do anyway. I tried setting static width and height, but it seems to be ignoring them to some degree. Beyond that, the column widths are not defining the widths of the columns, but rather the number of pixels to add to the width of the column. Also, it doesn't actually add the specified number of pixels, but some seemingly arbitrary number any given time.

When there's too much data in a cell, it wraps, making the row taller, and thus changing the height of the Grid. That is unacceptable. I require a static height and width, and perhaps it could show the full contained value of the cell on mouseover. I need the values to not wrap or overflow in any way. Is there some way to achieve this?

When paging, the column widths change, throwing off the data alignment. It just looks bad, visually, to be paging through the data, and seeing the column widths changing (and the height of the Grid changing in response to taller rows, too).

Things I need to accomplish, broken out into a list:
  • Static column or cell widths
  • No wrapping of cell content, and no resulting overflow either (white-space: nowrap; overflow: hidden;)
  • Static row or cell heights
  • Static overall Grid height (cannot have scrolling Grids, because may be viewed on mobile platform where scrolling in child containers does not function)
How can I achieve those goals without too much hackery? I'm willing to add a CSS style to address the cell overflow and wrapping issues if necessary, but how about the column/cell widths and row/cell heights? I'm sure that the overall height issue will resolve itself once my rows stop changing height.

Thank you.

Best Regards,

Adrian
Adrian
Top achievements
Rank 1
 answered on 02 Aug 2012
0 answers
63 views
Hi All,

I am using remote datasource and binding this by using Odata service.

Example for Odata service: 
_WebServiceAddress + "dataapi/ProductGroupProducts?$orderby=Name&$filter=ProductGroupId eq guid'" + tSelectedId + "'"

and i am trying to filter datasource server side by using datasource filter option. 
Example: 

   $("#DivProductGroupDetailsTable").data("kendoGrid").dataSource.filter({
            logic: "or",
            filters: [
                    { field: "Name", operator: "contains", value: pSearchValue },
                    { field: "DataMatchKey", operator: "contains", value: pSearchValue }
                ]
        });

but i am getting following error:
":"Query parameter '$filter' is specified, but it should be specified exactly once."

Please advise.

Thank you in advance.

regards,
Shankar
Shankar
Top achievements
Rank 1
 asked on 02 Aug 2012
1 answer
480 views
Hello

I'm using the ListView to display different items. The item should have a different back color depending on the status of the item.
I was able to change the background-color of a element within the <li> by doing something like this:
<div ${data.Status == 0 ? "style=\"background-color:orange;\"" : (data.Status == 1 ? "style=\"background-color:darkred\"" : "style=\"background-color:darkgreen\"")}></div>
But here I still have the borders of the <li> element. Therefore I would like to set the background-color directly in the <li> element to solve the issue.

Is there a way to set the background-color of the ListItem depending on my Status-Property?

I found a way how to access the css of the parent.
http://stackoverflow.com/questions/258317/jquery-changing-background-of-parent-div 
But somehow I wasn't able to use this in the template.

Thanks in advance!

Kind Regards
Bruno
Kamen Bundev
Telerik team
 answered on 02 Aug 2012
1 answer
486 views
Hi,
I am trying to create a ListView with remote json/jsonp databinding for Kendo mobile.
I have seen the databinding demo (http://demos.kendoui.com/mobile/listview/databinding.html), but I can't seem to convert it into a json/jsonp web service.
I also tried with the non-mobile Kendo Web remote binding (http://demos.kendoui.com/web/datasource/remote-data.html) which works great by itself, but not in a Kendo mobile application.

is there a demo similar to the Kendo mobile ListView databinding demo (http://demos.kendoui.com/mobile/listview/databinding.html), but with a json/jsonp web service?

Many thanx
Ran
Ran
Top achievements
Rank 1
 answered on 02 Aug 2012
0 answers
114 views
what is the best way to handle the combobox request when serverFilter is true
how to bind filter[filters][0][field] in mvc3 like DataSourceRequest for kendo grid
Ibrahim
Top achievements
Rank 1
 asked on 02 Aug 2012
5 answers
3.8K+ views

I'm having a problem trying to set the Grid's datasource after the grid has been created.  Here is what I currently have, I've tried a bunch of diffenent vatiations of it, but none have worked.  I can see from the Dev Tools in IE9 that its making the service call.  

$(document).ready(function() {
    
    grid = $("#grid").kendoGrid({
        dataSource: {
               pageSize: 10
           },
           height: 800,
           scrollable: true,
           sortable: true,
           filterable: true,
           pageable: {
               input: true,
               numeric: false
           },
           columns: [
               {
                   field: "UnitId",
                   title: "ID"
               },
               {
                   field: "UnitName",
                   title: "Name",
                   width: 200
               },
               {
                   field: "Location",
                   width: 200
               },
               {
                   field: "Number",
                   title: "Number"
               },
               {
                   field: "Rating"
               },
               {
                   field: "Date",
                   title: "Date"
               }
           ]
       });
 
        setDataSource()
   });
 
 
    
       function setDataSource() {
           //check if the data is in the db
 
           var dataSource = new kendo.data.DataSource({   
               type: "json",
               transport: {
                   read: {
                       url: "http://localhost/DashboardServices/api/Assessments",
                       complete: function(e){ debugger; $("#grid").data("kendoGrid").dataSource.data(e); $("#grid").data("kendoGrid").dataSource.read();}
                   }
               },
               schema: {
                   model: {
                       fields: {
                           UnitId: { type: "string" },
                           UnitName: { type: "string" },
                           Location: { type: "string" },
                           Number: { type: "string" },
                           Rating: { type: "string" },
                           Assessed: { type: "date" }
                       }
                   }
               },
           });
 
       }
Atanas Korchev
Telerik team
 answered on 02 Aug 2012
18 answers
1.0K+ views
How do I change the contentUrl on a splitter pane...on an event, so the splitter is already defined, I want to change it based on a click event.

So the idea is the splitter pane is collapsed and not resizable on load...click an item, it becomes expanded, changes to resizable and collapsable, and gets a contentURL set based on the value passed in.

(also API lists contentURL as a Bool?)
contentUrl: Boolean(default: true)
charan
Top achievements
Rank 1
 answered on 02 Aug 2012
0 answers
268 views
How can I select one item from a ListView and move to another ListView. List Item can be  selected and removed easily. But how can I add selected listItem to another ListView.
Sanjeev
Top achievements
Rank 1
 asked on 02 Aug 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
Licensing
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?