Telerik Forums
UI for ASP.NET MVC Forum
3 answers
210 views

I'm trying to pass the selected rows in a grid to a controller action and I keep getting "kendo.grid.min.js:11 Uncaught TypeError: Cannot read property '1' of undefined" as an error.

I am not 100% sure what is undefined exactly. I have rows selected. If I break out the javascript to see that there are selected items I get them back just fine. The items that are selected have data for all 3 columns as well, so I am kind of lost on to what is undefined. My razor view code is below, thanks.

001.@model SealRecommendationViewModel
002. 
003.@{
004.    ViewBag.Title = "Recommended Seal Models";
005.}
006. 
007.@{ Html.EnableClientValidation(false); }
008. 
009.@using (Html.BeginForm("RecommendedSealModels", "SealRecommendation", FormMethod.Post, new { id = "recommendedSealModels" }))
010.{
011.    <div class="separator">
012.        <h2>Recommended Seal Models</h2>
013.    </div>
014.    <div>
015.        @(Html.Kendo().Grid(Model.SealRecommendationObjects)
016.                .Name("FilteredGrid")
017.                .Columns(columns =>
018.                {
019.                    columns.Bound(s => s.SealTechnology).Title("Technology").Width(100);
020.                    columns.Bound(s => s.CategoryCode).Title("Seal Model").Width(100);
021.                    columns.Bound(s => s.Name).Title("Model Name").Width(100);
022.                })
023.                .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
024.                //.Sortable()
025.                .DataSource(data => data.Server().Model(m => m.Id(p => p.ProductID)))
026.                .Events(events => events.Change("selectSealRecommendation"))
027.        )
028.        <button id="btnBackBtn" class="buttonLeft" type="button" value="Back" onclick="location.href='@Url.Action("Index", "SealRecommendation")'">Back</button>
029.        <button id="btnSolution" class="buttonRight" type="submit" value="Next" style="" onclick="submitSelectedSealModels();">Next</button>
030.    </div>
031.}
032. 
033.<script type="text/javascript">
034.    $(document).ready(function () {
035.        //Default functionalities
036.        var checkSeals = $('input:checkbox[id^="checkedSealModel"]:checked');
037.        $("#btnBackBtn").click(function () {
038.            window.location = '@Url.Action("Index", "SealRecommendation")';
039.        });
040.        if (checkSeals.length > 0) {
041.            $('#btnSolution').removeAttr("disabled");
042.        }
043.        else {
044.            $("#btnSolution").attr("disabled", "disabled");
045.        }
046.        //CheckBox click event
047.        $("input[id ^= 'checkedSealModel']")
048.            .on('click',
049.                function() {
050.                    var checkedSeals = $('input:checkbox[id^="checkedSealModel"]:checked');
051.                    if (checkedSeals.length > 0) {
052.                        $('#btnSolution').removeAttr("disabled");
053.                    }
054.                    if (checkedSeals.length < 1) {
055.                        $('#btnSolution').attr("disabled", "disabled");
056.                    }
057.                    if ($('input:checkbox[id^="checkedSealModel"]').length == checkedSeals.length) {
058.                        $("#checkAllSealModels").attr("checked", true);
059.                    } else {
060.                        $("#checkAllSealModels").attr("checked", false);
061.                    }
062.                });
063.        //CheckAll checkbox click
064.        $("#checkAllSealModels")
065.            .on('click',
066.                function() {
067.                    if ($("#checkAllSealModels").is(':checked') == true) {
068.                        $('#btnSolution').removeAttr("disabled");
069.                        $('input:checkbox[id^="checkedSealModel"]')
070.                            .each(function() {
071.                                $(this).attr('checked', true);
072.                            });
073.                    } else {
074.                        $('#btnSolution').attr("disabled", "disabled");
075.                        $('input:checkbox[id^="checkedSealModel"]')
076.                            .each(function() {
077.                                $(this).attr('checked', false);
078.                            });
079.                    }
080.                });
081.    });
082. 
083.    function submitSelectedSealModels() {
084.        var entityGrid = $("#FilteredGrid").data("kendoGrid");
085.        var selectedItems = entityGrid.dataItem(entityGrid.select());
086. 
087.        var data = selectedItems.toJSON();
088. 
089.        var customerForm = new AjaxForm("recommendedSealModels");
090.        var form = customerForm.getForm(true);
091. 
092.        AjaxServiceCall(form.action, form.method, data);
093.    }
094. 
095.    function selectSealRecommendation(arg) {
096.        var selected = $.map(this.select(), function (item) {
097.            return $(item).text();
098.        });
099.        $('#btnSolution').prop("disabled", false).removeClass("disabled");
100.    }
101.</script>

Kostadin
Telerik team
 answered on 16 Jun 2016
5 answers
1.3K+ views

Hi,

I'm using client side grid dataSource filter: kendo.data.DataSource.filter with operator: "eq", but it returns case insensitive results.

For example:

<script>
var dataSource = new kendo.data.DataSource({
  data: [
    { firstName: "joe", lastName: "doe" },
    { firstName: "Joe", lastName: "Doe" }
  ]
});
dataSource.filter( { field: "lastName", operator: "eq", value: "doe" });
var view = dataSource.view();
console.log(view.length);
</script>

returns 2. 

Is there a way to make it case sensitive?

Thanks,

-Yuriy

 

 

Pavlina
Telerik team
 answered on 16 Jun 2016
5 answers
972 views

Hello,

 

I've a kendo Grid in MVC that used ClientRowTemplate for coloring rows depending on the given data. Now we want to add details grid while keeping the current row template.

I've followed your example in http://demos.telerik.com/aspnet-mvc/grid/detailtemplate

and I was able to add the details grid while I've to remove ClientRowTemplate  in order to have the grid rendered.

I need an example showing how to use the ClientRowTemplate in both main grid and the details one, in MVC.

 

Thanks You!

Radoslav
Telerik team
 answered on 16 Jun 2016
1 answer
84 views

Hi, I'm trying to understand and replicate this demo: http://demos.telerik.com/aspnet-mvc/grid/localization

But since it is missing the source, I'm lost.

When are you going to update this document?

I'm trying to do the exact same thing on my application, I want the user to be able to select the language he/she prefers and see all widgets in that language.

I already have a DropDwonList for the languages and it is already working for the strings in my application, but I don't know how to change the telerik's widgets language.

Can somebody help me, please?

Thanks!

Vessy
Telerik team
 answered on 15 Jun 2016
1 answer
196 views

I am using the WYSIWYG Editor and trying to add a table. We have our own classes we use for the tables, so I am defining those classes at the top of the html and then adding my table in the html view. If I add a table with a class, after hitting update the editor adds the class "k-table" to the table. Is there a way to prevent this?

Thanks,

Jim

Ianko
Telerik team
 answered on 15 Jun 2016
3 answers
177 views

I'm using the "Filter Multi Checkboxes" and I am trying to hook it up to an existing MVC Controller Action which returns JSON data but in a different structure to what is expected.

Currently my code is

columns
    .Bound(p => p.Customer)
    .Filterable(ftb => ftb
        .Multi(true)
        .DataSource(ds => ds
            .Read(r => r
                .Action("Customers_Read", "SalesLedger")
            )
        )
    );

And this expects the action to return data in this structure

[{"Customer":"John"},{"Customer":"Bob"},{"Customer":"Mary"}]
But my action return the data as

["John","Bob","Customer"]

Is this possible?

Thanks â€‹

 

Stefan
Top achievements
Rank 1
 answered on 15 Jun 2016
1 answer
838 views

I would like to be able to hide the spreadsheet formula bar as well as the row and column headers.  Is there any way to accomplish this?

Thanks,

Mark

Vessy
Telerik team
 answered on 15 Jun 2016
1 answer
80 views

I have a grid where a button on the form calls addRow().  So the row is in insert mode.  How do I prevent the user from leaving the row until the values entered have been entered and are valid.  Right now it is showing the hints when the user goes to another column without completing the cell but the user can completely leave the row and it remains empty of values.

 

Is there a way to call validate before calling grid.saveChanges()?

 

Eyup
Telerik team
 answered on 14 Jun 2016
3 answers
168 views

Hello,

I have the problem that one ForeignKey column depends on another ForeignKey column (see attached picture). As you can see the 
columns "Fachgruppe" depends on value in column "Sparte" - now this is not correct because I don't know how to display only the
values for "Fachgruppe" which depends on the current value of column "Sparte" in the row (for display and editing)?

these are sample values for that columns
Sparte     Fachgruppe
1             1
1             2
1             3
2             1
2             2
3             1
3             2

Is there a way to do this with MVC Grid?

robert

Konstantin Dikov
Telerik team
 answered on 14 Jun 2016
1 answer
106 views

I have a client side datasource grid with several count and sum aggregates that display their data correctly, but they doesn't update when a user filters a column that affects the result of such aggregates. Is it possible to do that? The only way I can think of is with an event that updates the footer, but I don't know how to achieve this.

My grid was created using razor.

Thanks in advance.

Viktor Tachev
Telerik team
 answered on 14 Jun 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?