Telerik Forums
Kendo UI for jQuery Forum
3 answers
237 views
I have a grid that when it tries to update, the ID field of my model is an empty guid when it gets back to the controller. I am displaying the column in the guid and the value is definitely there. What would cause the ID to be stripped out like that?

Here is my view with the grid:

@model List<Common.Models.Brand>
 
@{
    ViewBag.Title = "Maintain Brands";
}
 
<h2>Maintain Brands</h2>
 
@(Html.Kendo().Grid(Model)
    .Name("MaintainBrandsGrid")
    .Columns(columns =>
    {
        columns.Bound(brand => brand.BrandId).Title("Id");
        columns.Bound(brand => brand.BrandName).Title("Brand Name");
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(185);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable(scr=>scr.Height(430))
    .Filterable()   
    .DataSource(dataSource => dataSource       
        .Ajax()
        .PageSize(20)
        .ServerOperation(false)
        .Model( model => model.Id( brand => brand.BrandId))
        .Create( create => create.Action("AddBrand", "BrandMaintenance"))
        .Update( update => update.Action("UpdateBrand", "BrandMaintenance"))
        .Destroy( delete => delete.Action("RemoveBrand", "BrandMaintenance"))
        )       
     )

And here is the UpdateBrand method from the BrandMaintenance controller:

//
        // POST: /BrandMaintenance/UpdateBrand
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult UpdateBrand([DataSourceRequest]
                                        DataSourceRequest request, Brand brand)
        {
            if (brand != null && ModelState.IsValid)
            {
                var bll = new CatalogMaintenanceBll();
                bll.UpdateBrand(brand);
            }
 
            return Json(new[] { brand }.ToDataSourceResult(request, ModelState));
        }

I have several other grids that were created the exact same way and they are all working, so I am wondering what I could possibly be missing that could cause this.

Thanks for any help!








Cool Breeze
Top achievements
Rank 1
 answered on 25 Mar 2014
2 answers
203 views
Hello everybody,

i'm trying to make one grid with Hierarchy, but the hierarchy grid return all rows everytime.

To populate the grids, i have two json files:
-OS.json to principal;
-ITEM.json to hierarchy grid;

OS.json:
[{"cdOS":474103,"cdSelb":"X112","solicitante":"CLEBSON "},
{"cdOS":474104,"cdSelb":"A335","solicitante":"FERNANDO "}]

ITEM.json:
[{"cdOS":474103,"status":"ABERTO","usuario":"nivaldo.oliveira"},
{"cdOS":474103,"status":"FECHADO","usuario":"carlos.alberto"},
{"cdOS":474104,"status":"ABERTO","usuario":"nivaldo.oliveira"},
{"cdOS":474104,"status":"FECHADO","usuario":"carlos.alberto"}]



<div id="grid"> </div>

                $(document).ready(function() {
                    var element = $("#grid").kendoGrid({
                        dataSource: {
                            type: "json",
                            pageSize: 10,
                            serverPaging: true,
                            serverFiltering: true,
                            serverSorting: true,
                            transport: {
                                read: {
                                    url: "js/OS.json",
                                    dataType: "json"
                                },
                                schema: {
                                    model: {
                                        fields: {
                                            cdOS: { type: "number" },
                                            cdSelb: { type: "string" },
                                            solicitante: { type: "string" }
                                        }
                                    }
                                }
                            }
                        },
                        height: 550,
                        filterable: true,
                        sortable: true,
                        pageable: true,
                        detailInit: detailInit,
                        dataBound: function() {
                            this.expandRow(this.tbody.find("tr.k-master-row").first());
                        },
                        columns: [{
                            field: "cdOS",
                            title: "OS"
                        },
                        {
                            field: "cdSelb",
                            title: "SELB"
                        },
                        {
                            field: "solicitante",
                            title: "Solicitante"
                        }]
                        });
                    });

                function detailInit(e) {
                    $("<div/>").kendoGrid({
                        dataSource: {
                            type: "json",
                            transport: {
                            read: {
                                url: "js/ITEM.json",
                                dataType: "json"
                                },
                                schema: {
                                    model: {
                                        fields: {
                                            cdOS: { type: "number" },
                                            status: { type: "string" },
                                            usuario: { type: "string" }
                                        }
                                    }
                                }                                
                            },
                            serverPaging: true,
                            serverSorting: true,
                            serverFiltering: true,
                            pageSize: 6,
                            filter: { field: "cdOS", operator: "eq", value: e.data.cdOS }
                        },
                        scrollable: true,
                        sortable: true,
                        pageable: true,
                        columns: ["cdOS", "status","usuario"]
                    }).appendTo(e.detailCell);
                }


Anybody can help-me to resolve this issue?
I wanna to return only two rows in hierarchy grid, for one row in principal grid, the link is "CdOS".

Thanks!
Umesh
Top achievements
Rank 1
 answered on 25 Mar 2014
2 answers
119 views
Ok... frustratingly this is the second time I'm writing this as the first post failed for some reason.

I know there is a similar post to this here, http://www.telerik.com/forums/stacked-column-chart-where-group-is-a-property but the example code looks nothing like the api documentation, so hopefully someone can explain what's wrong with mine.  The grouping is missing the first day completely!

Json looks like:
[{"tdate": "2014-03-18T00:00:00", "data": 652.48 , "CatName": "Starters"},{"tdate": "2014-03-18T00:00:00", "data": 1245.87 , "CatName": "Spirits"},{"tdate": "2014-03-21T00:00:00", "data": 326.55 , "CatName": "Beers"},{"tdate": "2014-03-22T00:00:00", "data": 124.28 , "CatName": "Beers"},{"tdate": "2014-03-24T00:00:00", "data": 785.24 , "CatName": "Starters"},{"tdate": "2014-03-24T00:00:00", "data": 444.74 , "CatName": "Beers"},{"tdate": "2014-03-24T00:00:00", "data": 345.54 , "CatName": "Spirits"}]

HTML
<div id="chart"></div>

Script:
var myTheme = 'metro';

var myds = $('#MainContent_hdn1').val();
var jsondata = $.parseJSON(myds);

var mydatasource = new kendo.data.DataSource({
group: [
{ field: "CatName" }
],
sort: { field: "tdate", dir: "asc" },
data: jsondata
});

$("#chart").kendoChart({
dataSource: mydatasource,
series: [{
field: "data"
}],
group: { field: "CatName" },
categoryAxis: {
field: "tdate",
baseUnit: 'day',
type: 'date',
majorGridLines: {
visible: false
},
line: {
visible: false
}
},
seriesDefaults: {
stack: true
},
chartArea: {
height: 250
},
theme: myTheme,
tooltip: {
visible: true,
template: "#= series.name #: #= value #"
}
});

Output looks like attached pic.
Iliana Dyankova
Telerik team
 answered on 25 Mar 2014
2 answers
620 views
I'm trying to hook up the new locked column functionality, and having some odd display behavior with my footers.  It looks like the footer of non-locked columns are wrapping around underneath the locked footers instead of showing under the appropriate columns.  I was able to reproduce this with the demo page by adding footer templates to the columns there (which can be seen below).  Is this a bug or something that is not supported?  In my case, I have some columns where I want to show the sum of the data in the footer if possible.  Thanks for your help!

Regards,
Brian

<!DOCTYPE html>
<html>
<head>
    <title>Frozen columns</title>
    <meta charset="utf-8">
    <link href="../../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../../styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="../../../styles/kendo.default.min.css" rel="stylesheet">
 
    <script src="../../../js/jquery.min.js"></script>
    <script src="../../../js/kendo.web.min.js"></script>
    <script src="../../content/shared/js/console.js"></script>
    <script>
         
    </script>
     
     
</head>
<body>
     
        <a class="offline-button" href="../index.html">Back</a>
     
    <div id="example" class="k-content">
    <div id="grid"></div>
 
    <script>
        $(document).ready(function() {
            $("#grid").kendoGrid({
                dataSource: {
                    type: "odata",
                    transport: {
                        read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
                    },
                    schema: {
                        model: {
                            fields: {
                                OrderID: { type: "number" },
                                ShipCountry: { type: "string" },
                                ShipName: { type: "string" },
                                ShipCity: { type: "string" },
                                ShipAddress: { type: "string" }
                            }
                        }
                    },
                    pageSize: 30
                },
                height: 430,
                sortable: true,
                reorderable: true,
                groupable: true,
                resizable: true,
                filterable: true,
                columnMenu: true,
                pageable: true,
                columns: [ {
                        field: "OrderID",
                        title: "Order ID",
                        locked: true,
                        lockable: false,
                        width: 120,
                        footerTemplate: "Order ID"
                    }, {
                        field: "ShipCountry",
                        title: "Ship Country",
                        width: 200,
                        footerTemplate: "Ship Country"
                    }, {
                        field: "ShipCity",
                        title: "Ship City",
                        width: 160,
                        footerTemplate: "Ship City"
                    },{
                        field: "ShipName",
                        title: "Ship Name",
                        locked: true,
                        width: 200,
                        footerTemplate: "Ship Name"
                    },  {
                        field: "ShipAddress",
                        lockable: false,
                        width: 300,
                        footerTemplate: "Ship Address"
                    }
                ]
            });
        });
        </script>
</div>
 
     
             
</body>
</html>

Brian Roth
Top achievements
Rank 1
 answered on 25 Mar 2014
2 answers
185 views
I am finding it impossible to use the Chrome Developers debugger today. The issue is constant DOM errors of the form:

event.returnValue is deprecated. Please use the standard event.preventDefault() instead.

Coming from jquery-1.9.1 

This is fixed in newer versions of jquery,

But I am using Kendo UI Complete v2013.3.1324 and that comes with 1.9.1

Suggestions?

using Chrome 33.0.1750.154 m


Dr.YSG
Top achievements
Rank 2
 answered on 25 Mar 2014
7 answers
168 views
I have some footer tabs that are typically a green/brown color depending on their selection status. They have an icon as well as some text below them.

On the windows simulator, however, the icons are white and only the text changes color correctly. Also, every now and then the icons all turn black instead of white.
Michael
Top achievements
Rank 1
 answered on 25 Mar 2014
1 answer
153 views
I'm using data binding with MVVM for my grid and am trying to apply a custom filter but it doesn't seem to be picking it up am I doing something wrong?

data-filterable="extra: false, operators: { string: { startswith: 'starts with', eq: 'Is equal to' , neq: 'Is not equal to' } }"
Alexander Valchev
Telerik team
 answered on 25 Mar 2014
3 answers
167 views
Do the Kendo UI Data Viz javascript APIs for the chart, sparklines, etc support updates to the underlying data source? For example, I'm going to have a JavaScript data source for a scatter plot and when the data source array is updated, I'd like the charts to reload the data and animate the points into the new position. Is this something Kendo supports?
Iliana Dyankova
Telerik team
 answered on 25 Mar 2014
1 answer
428 views
I have a kendo editor control which is used to edit text containing <br> tags for newlines.  The text is long, causing the editor to show a scroll bar.  To preserve compatibility with existing data, I have overridden the newline command to insert <br> tags instead of paragraphs:

      $("#txtEditor").kendoEditor({
        tools: [
          { name: "insertLineBreak", shift: false },
        ]
      });

This works fine, except that when I do this and insert a new line near the top, now the editor scrolls to the end of the text block, which makes the scroll bar jump down.  Is there any way to avoid this happening?

I am using Kendo UI Complete v2013.3.1119 and the JQuery version it came with, Windows 7, tested in Firefox 27.  I can replicate this in the demo on the Kendo site as well by inserting some text and using shift+enter to insert some new lines.
Dimo
Telerik team
 answered on 25 Mar 2014
5 answers
731 views
I added a row manually to a hierarchical kendo grid, where the new row is added to the child kendo grid row after the parent row is expanded. It opens up the popup editor and closes immediately.

Here's the Hierarchy template and the parent grid. The onHierarchy1Save occurs when a new Hierarchy1 is added to the database, it expands the row which makes the Hierachy2 grid to show up, get the Hierarchy2 grid and inserts a new row to it. This opens up a popup editor which gets cancelled immediately without adding any new row to it.

    @(Html.Kendo().Grid<Heirarchy>()
              .Name("Hierarchy1")
              .Columns(c =>
              {
                  c.Bound(h => h.Name).Title("Name");
                  c.Command(command => command.Edit()).Width(90);
              })
              .Editable(editable =>
              {
                  editable.Mode(GridEditMode.PopUp);
                  editable.Window(window => window.Title("Edit Details").Width(500));
              })
              .ToolBar(toolbar => toolbar.Create().Text("Add new hiearchy2"))
              .DataSource(dataSource => dataSource.Ajax()
                  .Model(model => model.Id(div => div.primaryKey1))
                  .Batch(true)
                  .Read("GetHierarchies1", "Home")
                  .Update("UpdateHierachies1", "Home")
                  .Create("CreateHierarchies1", "Home")
              )
              .Navigatable()
              .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
              .ClientDetailTemplateId("Hierarchy2Template")
              .Events(events => events.Save("onHierarchy1Save")))


    <script id="Hierarchy2Template" type="text/kendo-tmpl">
        @(Html.Kendo().Grid<Hierarchy2>()
              .Name("Hierarchy2Grid_#=primaryKey1#")
              .Columns(columns =>
              {
                  columns.Bound(h => h.Name).Width(150);
                  columns.Command(command => command.Edit()).Width(90);
              })
              .Editable(editable =>
              {
                  editable.Mode(GridEditMode.PopUp);
                  editable.Window(window => window.Title("Edit Details").Width(500));
              })
              .ToolBar(toolbar => toolbar.Create().Text("Add new hierarchy2"))
              .DataSource(dataSource => dataSource
                  .Ajax()
                  .PageSize(5)
                  .Batch(true)
                  .Model(model => model.Id(h => h.primaryKey2))
                  .Read(read => read.Action("GetHierarchy2", "Home", new {foreignKey = "#=primaryKey1#"}))
                  .Update("UpdateHierarchy2", "Home")
                  .Create("CreateHierarchy2", "Home", new {foreignKey = "#=primaryKey1#"})
              )
              .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
              .ToClientTemplate())
    </script>

    function onHierarchy1Save(e) {
            e.preventDefault();
            this.saveChanges();
            if (!e.model.Id) {
                if (confirm("Do you want to add a new hierarchy2?")) {
                    this.expandRow(this.tbody.find("tr.k-master-row").first());
                    var primaryKey1 = e.model.primaryKey1;
                    var grid = $('#Hierarchy2Grid_' + primaryKey1).data("kendoGrid");
                    grid.addRow();
                }
            }
        }
Richard
Top achievements
Rank 1
 answered on 25 Mar 2014
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?