Telerik Forums
UI for ASP.NET MVC Forum
1 answer
1.2K+ views
I've been looking, but I can't seem to find a clear example of what I'm looking for. I wish to add an ajax.ActionLink to each row of my grid that has the ID of the row.  When this link is clicked, I wish for this ID to be sent back to the controller so that I can do some additional functions, and pass back a new set of data to be displayed in a different div.  This is my code for now.  This particular grid performs one function, which is to maintain the information on any new attorneys that we receive correspondence for, and they're able to add and update as needed.  Now, the function I need is for them to select an attorney, new or current, and send that ID back to a controller to perform a completely separate update to a different table, and display the details of that update in a grid in a separate partial view contained in the "attyImgDtls" div referenced.

If the Ajax link isn't possible, I need to know how to add a link to each row, and send the ID of that row back to a controller to perform the new update that I need.  I already tried adding a separate custom button, but got errors stating that a custom button couldn't be added for my particular situation.  I'm not quite sure why there isn't a simple "select" action available along with the Read, Update, and Create actions.

@(Html.Kendo().Grid(Model)

        .Name("SubroAttorneys")

        .Columns(columns =>

        {

            columns.Template(@<text></text>).ClientTemplate(

                @Ajax.ActionLink("Add", "SelectNewAtty", new { EquipmentId = "#= SubroAttyID#" }, 

                 new AjaxOptions { HttpMethod = "POST", Confirm = "Are you sure?", UpdateTargetId="attyImgDtls", InsertionMode = InsertionMode.Replace }).ToHtmlString()

            );

                        columns.Bound(a => a.SubroAttyFirmName).Title("Firm Name").Width(250);

            columns.Command(command => { command.Edit(); }).Width(250);


 

        })

        .ToolBar(toolbar => toolbar.Create())

        .Editable(editable => editable.Mode(GridEditMode.PopUp))

        .DataSource(dataSource => dataSource

            .Ajax()

            .Model(model => model.Id(a => a.SubroAttyID))

                .Create(update => update.Action("AttyEditingPopup_Create", "ClerkMain"))

                .Update(update => update.Action("AttyEditingPopup_Update", "ClerkMain"))

                .Read(update => update.Action("AttyEditingPopup_Read", "ClerkMain"))


 

        )

        .Selectable()        

        .ClientDetailTemplateId("template")
       )





Dimo
Telerik team
 answered on 15 May 2014
1 answer
393 views
Hi All,

I am learning on Kendo grid features with MVC4 and EF5 db first.
I am able to use dropdown in kendo grid for update.
But found small issue with selecting the first item in the dropdown inside kendo grid when creating new record.
Step to reproduce:
1. "Add new record" then try to fill in the type as dropdownlist with the first item available.
2. When you get focus to the dropdownlist, it is showing the first item as default, but when you lost focus (without clicking any item), it will not fill in the grid with the first item from dropdown list.
3. Even if you try clicking on the first item from the dropdownlist, it is still not filling the grid with the first item.

It is working find if you selecting the second or thirds and so on. Only happened to the first item of the dropdownlist.
Please find the code in the attachment.
Any help will be much appreciated.





Vladimir Iliev
Telerik team
 answered on 15 May 2014
1 answer
126 views
I want to set the min/max of a datepicker with javascript. Currently I can do this via $('...').data('tDatePicker').minValue/maxValue = new Date(...) however, this does not reflect in the rendering of the calendar. Is there a way to rerender the calendar?

Thanks.
Georgi Krustev
Telerik team
 answered on 15 May 2014
3 answers
426 views
I have a timesheet grid that is setup for batch editing. There are row totals and column totals and a bunch of decimal data in each cell. Each row has data for Monday through Friday for the first week and Mo-Fri for the second week.  Totals are updated for Week 1 and Week2 as well as the 2 week total. Individual lines in the grid represent projects that are being billed against.

I have the grid set up to calculate the row totals as the user enters information in each cell and tabs to the next by hooking into the gridSave event and running javascript to do a running total and updating the row total field. Here's an example.

//Calculate week sums and total sums
   function gridSave(e) {
 
       
           var Mo1_time = e.values.Mo1_time,
                Tu1_time = e.model.Tu1_time,
                We1_time = e.model.We1_time,
                Th1_time = e.model.Th1_time,
                Fr1_time = e.model.Fr1_time,
                Sa1_time = e.model.Sa1_time,
                Su1_time = e.model.Su1_time,
                Mo2_time = e.model.Mo2_time,
                Tu2_time = e.model.Tu2_time,
                We2_time = e.model.We2_time,
                Th2_time = e.model.Th2_time,
                Fr2_time = e.model.Fr2_time,
                Sa2_time = e.model.Sa2_time,
                Su2_time = e.model.Su2_time,
                Wk1_time = 0,
                Wk2_time = 0
 
           Wk1_time = Mo1_time + Tu1_time + We1_time + Th1_time + Fr1_time + Sa1_time + Su1_time;
           Wk2_time = Mo2_time + Tu2_time + We2_time + Th2_time + Fr2_time + Sa2_time + Su2_time;
 
           e.model.set("Wk1_time", Wk1_time);
           e.model.set("Wk2_time", Wk2_time);
 
           e.model.set("Sum_time", Wk1_time + Wk2_time);
       }

What I'd like to do is expand this to also do a column total and update the aggregate in the footer, but I'm not sure how to do this. (Need to have a total for each day of the week). Right now I have it set so that the aggregates properly calculate column totals and display when the grid data is first loaded from the controller, but then they are static until all data is saved and the grid is re-populated. I need real-time updates.

Thanks in advance!
Petur Subev
Telerik team
 answered on 15 May 2014
3 answers
325 views
Hello,

I am using the "Export Grid to PDF" from the Code Library. 
http://www.kendoui.com/code-library/mvc/grid/export-grid-to-pdf.aspx

It works great, but I need to be able to choose which rows to export to PDF, with a checkbox, not the entire grid. 

I created this checkbox:
columns.Template(e => e.IsChecked).ClientTemplate("<input type='checkbox' #= IsChecked ? checked='checked':'' # value='#=EmployeeID#' />")
How can I access this in the controller, where the method to create the export is located?

Can someone point me in the right direction?



Petur Subev
Telerik team
 answered on 15 May 2014
6 answers
179 views
Hi,

we're using a Grid with Virtual Scroll Paging enabled and have found that when we scroll down the list and get past the PageSize record (in our case its 300) and its time for it to retrieve the next set of records it calls the controller function defined in .Read() twice... any idea why it calls it twice !? 

Thanks.

Sincerely,

-Igor
Alexander Popov
Telerik team
 answered on 15 May 2014
6 answers
524 views
I have a menu where I wanted to make the text labels hidden and only have the top menu item choices show the image when the screen / client area is a smaller size and found it actually pretty easy to do:

<style type="text/css">
@@media only screen and (max-width: 920px){
    #RootMenu .menuItemText { display:none; visibility: hidden;}                 
 }
</style>

and for the menu:

 @(Html.Kendo().Menu()        
                .Name("RootMenu")
                .HtmlAttributes( new {style="white-space:nowrap;overflow:hidden;max-height:38px;"} )
                .HighlightPath(false)
                .Orientation(MenuOrientation.Horizontal)
                .Items(items => {
                  
                    items.Add().Text("<span class='menuItemText'>Home</span>").Action("Index", "Home").ImageUrl("~/Images/home-white-24.png").Encoded(false);
                 })
        
 )

The key is to wrap the menu item text in span with a classname and making sure .Encoded(false) is set.

From there the media query will do the rest.

Have it working quite nicely at http://www.renepilon.com

Mark
Top achievements
Rank 1
 answered on 15 May 2014
2 answers
225 views
Hi All,

I am trying the Kendo grid. Especially when using the incell mode. It seem like i can't go to the next cell bellow.
If you imagine excel, i want update the sheet in column A. Now i am updating the value of A1, then i want to update cell A2.
In Excel i can just use the down key to move to cell A2.
How can we do it in Kendo Grid?

Please find the code at other thread:
http://www.telerik.com/forums/can%27t-choose-the-first-item-in-dropdown-on-kendo-grid-colum-foreignkey

Thanks in advance.
Csa
Top achievements
Rank 1
 answered on 15 May 2014
1 answer
189 views
I have some questions regarding the MVC Server wrappers.

1. Is there any true benefit for the MVC Server wrappers other than time saved form manually coding the JS? Like are there some special tricks or handlers that are only available via the server wrappers?

2. Is there anyway to specify the dataType for the Wrapper DataSource builder? Example if im using WebApi to serve some data if i use the grid and use the Ajax or WebApi Datasource builder i get nothing but using that same WebApi endpoint if i use the client-side initializing it works. Sample code at the end.

3. What are the pros and cons for the server side functions like Paging, sorting etc..

***************** CODE for # 2 ************************
@model Tsms.Az.Dds.Dto.ViewModels.Classroom.AvailableViewModel
 
@{
    ViewBag.Title = "WebApi";
}
 
<h2>WebApi</h2>
 
<h3>MVC Wrappers</h3>
<div>
    @(Html.Kendo()
        .Grid<Tsms.Az.Dds.Dto.ViewModels.Classroom.AvailableGridItem>()
        .Name("AvailableClassesGrid")
        .Columns(columns =>
        {
            columns.Bound(c => c.ClassDateColumn).Title("Date").Width(150)
                .ClientTemplate(
                    "<span class='ac#= ClassroomType#-#: LanguageType# ;'>#= ClassDateColumn#</span>" +
                    "<br/><br/>" +
                    "# if ( window.location.pathname.indexOf('/Register/Classroom') == 0 ) { #" +
                        "<a data-tsms='acAction' class='button red'><i class='icon-ok'></i> Select</a>" +
                    "# } else { #" +
                        "<a href='Register/Classroom?classID=#=ClassroomID#' data-tsms='acAction' class='button red'>Register</a>" +
                    "# } #"
                );
            columns.Bound(c => c.ClassLocationColumn).Title("Address").Encoded(false).ClientTemplate("<span class='ac#= ClassroomType#-#: LanguageType# ;'>#= ClassLocationColumn#</span>");
            columns.Bound(c => c.ClassDirectionsColumn).Title("Directions").Width(250).Encoded(false).ClientTemplate("<span class='ac#= ClassroomType#-#: LanguageType# ;'>#= ClassDirectionsColumn#</span>");
            columns.Bound(c => c.DisplayCity).Visible(false);
            columns.Bound(c => c.ClassTimeColumn).Visible(false);
        })
        .Pageable(p => p.Enabled(Model.GridSettings.PageableSettings.Enabled).PageSizes(Model.GridSettings.PageableSettings.Enabled))
        .Sortable(s => s.Enabled(Model.GridSettings.SortableSettings.Enabled))
        .Scrollable(s => s.Enabled(Model.GridSettings.ScrollableSettings.Enabled))
        .Selectable(s => s.Enabled(Model.GridSettings.SelectableSettings.Enabled))
        .Filterable(f => f.Enabled(Model.GridSettings.FilterableSettings.Enabled))
        .DataSource(source => source
            .Ajax()
            .ServerOperation(false)
            .Read(read => read.Url("/api/classroom/get-available-grid-list-test").Type(HttpVerbs.Get))
        )
        .Deferred()
    )
</div>
 
<hr />
<h3>Client Side</h3>
<div id="grid"></div>
 
@section scripts
{
<script>
                $(document).ready(function() {
                    $("#grid").kendoGrid({
                        dataSource: {
                            type: "json",
                            transport: {
                                read: "/api/classroom/get-available-grid-list-test"
                            },
                            pageSize: 5,
                            serverPaging: false,
                            serverFiltering: false,
                            serverSorting: false
                        },
                        height: 430,
                        filterable: true,
                        sortable: true,
                        pageable: true,
                        columns: [{
                                field: "ClassDateColumn",
                                filterable: false
                            },
                            "ClassLocationColumn"
                        ]
                    });
                });
</script>
}
Vladimir Iliev
Telerik team
 answered on 14 May 2014
1 answer
1.9K+ views
I want to filter a grid via JavaScript, but cant seem to work out how to pass data,
I have tried like this, Can this be done, thanks
​
var grid = $("#StudentInvoices").data("kendoGrid");
grid.dataSource.read({ "page": 1, "pageSize": 10, "filter": "Paid~eq~false" })
Dimiter Madjarov
Telerik team
 answered on 14 May 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
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
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?