Telerik Forums
Kendo UI for jQuery Forum
1 answer
733 views

I really hope someone can assist me.  I am new to MVC and Telerik Controls.  I have use the Jquery version of the Telerik Grid to display lists of parent data from my database and implemented server paging/sorting etc and this has gone well so far.

I have a list of Issues and when an item is double clicked, an issue detail view is opened (this is a razor view, with additional information to display to that contained in the grid).  I have done this by implementing a jquery call on the double click of the kendo grid. (If there is a nicer way to do this using the popup mode please could someone let me know as I found popup mode relied on the data available to the grid??)

The issue detail view need to present a list of all issue comments related to the issue and allow adding/editing and removing of them.

I would like to use the kendo grid for this list too as their may be a lot of comments and I would like to implement paging for them.

I have EF as my data layer with unit of work and repository pattern and a business layer with business models.  I am then translating to View models and currently I have an Issue view model with a List<IssueCommentsVM> property populated.

However, I am currently getting the data for IssueComments via the grids read operation to a 'GetIssueComments' action on the controller.

Issues I am having:-

- I need to be able to create a new issue and add multiple issue comments to the grid and save both the issue and the issue comments entered at the same time

- When editing an issue, there may be a lot of comments, so I would like server side paging/filtering/sorting implemented, but when I change the page/filter etc, my edits will be lost??

Is there a good way of getting the kendo grid to add/edit and delete Issue Comments in bulk edit style way, maintaining state if pages are changed or filtering is applied so that when they save the Parent Issue, the child Issue Comment changes are all passed to the Issue Save action method.

I was thinking maybe there is a way to bind the grid to the parent models child data List<IssueCommentVM> and getting add/edit/delete to post and update this model and refresh the page and hence child grid, but then how would I handle paging etc as I don't want to return all comments to the parent model, just the requested page, but I still need to save changes.

Can anyone help me out, this seems so complicated, there has to be something I am missing in my understanding.

 

Kostadin
Telerik team
 answered on 19 Oct 2016
1 answer
604 views

I have attached a screen shot of the view that is rendering. I want to display a dropDownList in the Service Provider column that is dependent on the value selected in the Profiled Status column. So, if Royal Expedite is selected in the Profile Status column I would display a drop down with one set of values, and if Royal Expedite was selected in Profile Status I would display a different drop down with it's own set of values, etc. The problem is when the view is rendered the DropDownList is not initializing in the Service Provider column. In its place is a blank text box. 

 

Here is the action method to render the view:

public ActionResult ScheduleRoyalLogistics(Guid trackingCode)
        {
            var transientFile = _uploadFileService.GetUploadFileByTrackingCode(trackingCode);
            var awaitingScheduleRelation = _dropShipFileRelationService.GetByDropShipTrackingCode(trackingCode);

            var dropShipRelation = awaitingScheduleRelation == null
                ? _dropShipFileRelationService.GetBySenderFileId(transientFile.FileId).ToList()
                : _dropShipFileRelationService.GetByOffsetFileId(awaitingScheduleRelation.OffsetFileId).ToList();

            var uploadFile = _uploadFileService.GetUploadFileByFileId(dropShipRelation.First().OffsetFileId) ??
                             _uploadFileService.GetUploadFileByFileId(dropShipRelation.First().SenderFileId);

            var dropShipTypes = new List<DropShipTypeDropDown>();
            foreach (var dropShipType in Enum.GetValues(typeof(DropShipTypeEnum)))
            {
                dropShipTypes.Add(new DropShipTypeDropDown()
                {
                    DropShipTypeId = (int) dropShipType,
                    DropShipTypeName = Enum.GetName(typeof(DropShipTypeEnum), (int) dropShipType)
                });
            } 
            ViewData["dropShipTypes"] = dropShipTypes;

            var consolidateProviders =
                _dropShipServiceProviderRepository.GetDropShipServiceProviderByDropShipType(
                    (int) (DropShipTypeEnum.RoyalConsolidate));

            var expediteProviders = _dropShipServiceProviderRepository.GetDropShipServiceProviderByDropShipType(
                    (int) (DropShipTypeEnum.RoyalExpedite));


            var consolidateProviderModel = new List<ScheduleProviderDropShipModel>();
            foreach (var provider in consolidateProviders)
            {
                consolidateProviderModel.Add(new ScheduleProviderDropShipModel()
                {
                    ScheduleProviderId = provider.DropShipServiceProviderId,
                    ScheduleProviderName = provider.DropShipServiceProviderName
                });
            } 
            ViewData["consolidateProviderModel"] = consolidateProviderModel;

            var expediteProviderModel = new List<ScheduleProviderDropShipModel>();
            foreach (var provider in expediteProviders)
            {
                consolidateProviderModel.Add(new ScheduleProviderDropShipModel()
                {
                    ScheduleProviderId = provider.DropShipServiceProviderId,
                    ScheduleProviderName = provider.DropShipServiceProviderName
                });
            } 
            ViewData["expediteProviderModel"] = expediteProviderModel;  

            var model = new ScheduleRoyalLogisticsModel
            {
                TrackingCode = trackingCode,
                JobId = _headerRepository.GetFileHeader(uploadFile.FileId).JobId,
                MailClass = uploadFile.MailClassName,
                MailType = uploadFile.ParcelTypeName
            };  


            return View("ScheduleRoyalLogistics", model);
        }

 

Here is the grid in the view:

<div id="view" class="k-content">

                @(Html.Kendo().Grid<DropShipDestinationSummaryModel>()
                      .Name("ScheduleRoyalLogisticsGrid")
                      .Columns(columns =>
                      {
                          columns.Bound(c => c.DropShipDestinationSummaryId).Hidden(true);
                          //columns.Bound(c => c.DropShipType)
                          //    .ClientTemplate("#= getScheduleStatusIcon(data) #")
                          //    .Title("Status")
                          //    .Filterable(false);
                          columns.Bound(c => c.DropShipType)
                              .EditorTemplateName("_DropShipType")
                              .ClientTemplate("#=DropShipType.DropShipTypeName#")
                              .Title("Profiled Status").Sortable(false).HtmlAttributes(new {@class = "purple-background"});
                          columns.Bound(c => c.EntryLevel)
                              .Title("Destination");
                          columns.Bound(c => c.ServiceProvider).ClientTemplate(
                              "#if(#=DropShipType.DropShipTypeId# == 1){#" +
                              (Html.Kendo().DropDownList()
                                .Name("ServiceProvider_#=DropShipDestinationSummaryId#")
                                .DataValueField("ScheduleProviderId")
                                .DataTextField("ScheduleProviderName")
                                .BindTo((IEnumerable) ViewData["consolidateProviderModel"]).ToClientTemplate()).ToHtmlString() +
                              "#} else if(#=DropShipType.DropShipTypeId# == 2)  {#" +
                              (Html.Kendo().DropDownList()
                                .Name("ServiceProvider_#=DropShipDestinationSummaryId#")
                                .DataValueField("ScheduleProviderId")
                                .DataTextField("ScheduleProviderName")
                                .BindTo((IEnumerable) ViewData["expediteProviderModel"]).ToClientTemplate()).ToHtmlString() +
                              "#} else {#" +
                              "<p>TEST</p>" +
                              "#}#");
                          columns.Bound(c => c.PostalFacility)
                              .Title("Destination Entry");
                          columns.Bound(c => c.PieceCount)
                              .Title("Piece Count");
                          columns.Bound(c => c.Weight)
                              .Title("Weight");
                          columns.Bound(c => c.Cost).Format("{0:c2}")
                              .Title("Cost");
                          columns.Bound(c => c.PalletCount)
                              .Title("Pallet Count").HtmlAttributes(new {@class = "purple-background"});
                          columns.Bound(c => c.ScheduledPickup)
                              .Format("{0:M/d/yyyy h:mm tt}")
                              .EditorTemplateName("_ScheduleDateAndTime")
                              .Title("P/U Pickup").HtmlAttributes(new {@class = "purple-background"});
                          columns.Bound(c => c.DropDate)
                              .Format("{0:M/d/yyyy h:mm tt}")
                              .EditorTemplateName("_ScheduleDateAndTime")
                              .Title("Drop Date").HtmlAttributes(new {@class = "purple-background"});
                      })
                      .ToolBar(toolbar =>
                      {
                      toolbar.Save();

                      toolbar.Template(
                              @<text>

                                  @(Html.Kendo().DropDownList()
                                        .Name("dropShipTypeDropDownList")
                                        .DataTextField("DropShipType")
                                        .DataValueField("DropShipTypeId")
                                        .DataSource(source =>
                                        {
                                            source.Read(read =>
                                            {
                                                read.Action("GetDropShipTypes", "DropShip");
                                            })
                                                .ServerFiltering(true);
                                        })
                                        .SelectedIndex(0)
                                        )

                                  <button id="schedule" name="schedule" class="pull-right">Schedule</button>

                               </text>);


                      }).Events(x => x.DataBound("onGridDataBound"))
                      .HtmlAttributes(new {style = "margin:auto;"})
                      .Sortable()
                      .Pageable(pageable => pageable
                          .Refresh(true)
                          .PageSizes(new[] {25, 50, 75, 100})
                          .ButtonCount(5))
                      .Editable(editable => editable.Mode(GridEditMode.InCell))
                      .DataSource(datasource => datasource
                          .Ajax()
                          .Batch(true)
                          .Model(model =>
                          {
                              model.Id(d => d.PostalFacility);
                              model.Field(d => d.DropShipType).Editable(true);
                              model.Field(d => d.EntryLevel).Editable(false);
                              model.Field(d => d.MailType).Editable(false);
                              model.Field(d => d.PieceCount).Editable(false);
                              model.Field(d => d.PostalFacility).Editable(false);
                              model.Field(d => d.ScheduledPickup).Editable(true);
                              model.Field(d => d.ServiceProvider).Editable(true);
                              model.Field(d => d.DropDate).Editable(true);
                              model.Field(d => d.ScheduledBy).Editable(false);
                              model.Field(d => d.Cost).Editable(false);
                          }) 
                          .Read(read => read
                              .Action("GetScheduleRoyalLogistics", "DropShip", new {trackingCode = @Model.TrackingCode}))
                          .Update(update => update.Action("UpdateScheduleRoyalLogistics", "DropShip"))
                          .PageSize(25))
                      )
            </div>

 

Here is the action method for the Read action on the grid:

public ActionResult GetScheduleRoyalLogistics([DataSourceRequest] DataSourceRequest request, Guid trackingCode)
        {
            var uploadFile = _uploadFileService.GetUploadFileByTrackingCode(trackingCode);
            var awaitingScheduleRelation = _dropShipFileRelationService.GetByDropShipTrackingCode(trackingCode);  

            var dropShipRelation = awaitingScheduleRelation == null
                ? _dropShipFileRelationService.GetBySenderFileId(uploadFile.FileId).ToList()
                : _dropShipFileRelationService.GetByOffsetFileId(awaitingScheduleRelation.OffsetFileId).ToList();

            var allProviders = _dropShipServiceProviderRepository.GetAll();

            var parcelTypes = _parcelTypeRepository.GetParcelTypes();
            List<DropShipDestinationSummaryModel> result = new List<DropShipDestinationSummaryModel>();

            foreach (var relation in dropShipRelation)
            {
                result.AddRange(_dropShipDestinationSummaryService.GetByDropShipFileRelationId(relation.DropShipFileRelationId).Select(x =>
                    new DropShipDestinationSummaryModel()
                    {
                        DropShipDestinationSummaryId = x.DropShipDestinationSummaryId,
                        Cost = x.Cost,
                        Weight = x.Weight,
                        EntryLevel = Utility.GetDescriptionFromEnumValue((UspsFacilityTypeEnum)x.UspsFacilityType),
                        MailType = parcelTypes.Where(a => a.ParcelTypeId == x.ParcelTypeId).Select(y => y.ParcelTypeName).First(),
                        PieceCount = x.PieceCount,
                        PostalFacility = x.DestinationEntry ?? "",
                        ScheduledBy = x.ScheduledBy ?? "",
                        ScheduledPickup = x.PickupDate,
                        DropDate = x.DropDate,
                        PalletCount = x.PalletCount,
                        DropShipType = new DropShipTypeDropDown()
                        {
                            DropShipTypeId = (int)x.DropShipType,
                            DropShipTypeName = Enum.GetName(typeof(DropShipTypeEnum), x.DropShipType)
                        },
                        ServiceProvider = new ScheduleProviderDropShipModel()
                        { 
                            ScheduleProviderId = (int) x.DropShipServiceProviderId,
                            ScheduleProviderName = allProviders.Where(a => a.DropShipServiceProviderId == x.DropShipServiceProviderId).Select(z => z.DropShipServiceProviderName).First()
                        }
                    }));
            }

            return Json(result.ToDataSourceResult(request));
        }

 

any help would be greatly appreciated!

Kostadin
Telerik team
 answered on 19 Oct 2016
4 answers
390 views

Please refer to attachment, now I use the function of Multi-Column Header, I want to hide the secondary title. And these two columns are editable. How do I implement it?

I also find that after use the Multi-Column Header function, I cannot use the Locked function any more, is there any way to let them exist together?

  •  implement
Nick
Top achievements
Rank 1
 answered on 19 Oct 2016
5 answers
1.1K+ views

I am having a lot of trouble referencing a drop down list which does not have an ID but it has a data-container-for.

 

All i am trying to do is get the selected value in the dropdown list.

I have tried this which usually works when you have an ID.

var dd = $("#DashboardTypeId").data("kendoDropDownList");

any help would be appreciated 

Paul
Top achievements
Rank 1
 answered on 19 Oct 2016
7 answers
916 views
I am using KendoUI (upload) and I am trying to receive a file in a method in webapi from Kendo UI (upload) but the object received is null.
 
In the Index.cshtml



In webapi:
SaveController.cs



Please, I need an example for this situation. Thanks.








Dimiter Madjarov
Telerik team
 answered on 19 Oct 2016
2 answers
199 views

I have a layout using splitters and I have them collapsed when the view loads. From there I have a button to start an order and that button click triggers a popup, and in that popup there are 2 buttons a Save button and a Cancel button. The originating view has its own JavaScript file and the popup has its own JavaScript file, so this is where I think the trouble is happening. If everything was in the same JavaScript file then it would probably be easier to do. 

With all that information my question is when I click Save from the popup, how do I expand the splitter panes in the view from where the popup was called? 

Chris
Top achievements
Rank 1
 answered on 18 Oct 2016
5 answers
193 views

I am using jquery.validation 1.13 and kendo.web.js v2014.1.416

So, I have used Kendo Datepicker and Dropdown list on some of controls on my forms.
I have put some validations on the controls on server side, and added errors for the property if the values are not valid.
So when the server returns with error, the error on the specific properties are shown properly.
Now, when i enter values on the property and submit the form, the values (for properties with error only) are actually not being sent at all.

I am Using MVC .NET 5
eg:

ModelState.AddModelError("EndDate", "End Date cannot be earlier than today.");


Under careful inspection I found that, just when I click submit, the property control is being removed from the DOM. That is the cause of null data being sent.
- The values are being sent the first time.(before validation, even with client side validation).
- The values are not being sent for validation error input properties only(after server side validation error).

This specifically happens only on controls with Kendo UI,I have not checked with other Jquery UI plugins. The reason i am saying this is because, without use of the UI plugins the controls works properly and submits user data after error from server.

Hope i am clear with the problem.
Thank you.

Daniel
Telerik team
 answered on 18 Oct 2016
3 answers
207 views

Hi,

We've been waiting for years to get this "Resizing of tables, columns and rows" feature in the editor, which you finally implemented it in release 2016.3.914, thank you very much.

However, the selecting and resizing of the entire table in the IE-11 browser is extremely very difficult.

1. It's required user to really do a lots of mouse pointer narrowing in order to select the table and then start resizing it.

2. Many of the times when selecting the table and move the mouse in order to select the table marker for resizing, the table get unselected automatically by mouse move! It's very buggy.

3. In Dot Net WebBrowser object the "Editor Add Table" shortcut which highlight the number of rows and columns to add table, is not working unless add via Table Wizard. Please test and fix this bug in .Net WebBrowser object (System.Windows.Forms.WebBrowser).

Thank you.

Rumen
Telerik team
 answered on 18 Oct 2016
3 answers
384 views

Hi,

    I have a link in a column (using the "template" option) within a child grid, which on clicking will redirect to a new page. When I click the back button on the browser, I would like to have the grids in the state that they were in. I found an option for the main grid using setOptions and getOptions. But how do you manage the state of the child grid?

 

For example, if I have the second row of the main grid expanded which in turn has a child grid which is in the third page, when I return back, I want the second row of the main grid to be expanded and the child grid should be in the third page. Is this possible?

 

Thanks,

    Arun Kumar

Stefan
Telerik team
 answered on 18 Oct 2016
1 answer
182 views
Hello,

I'm trying to bind a multi dimensional data object to a kendo grid and am not having any success. My data looks something like this:

{
  "SalesSummary": {
      "ProNetSales": {
        "SubHeader": "Proj Net Sales",
        "Monday": 2800.00,
        "Tuesday": 3450.00,
        "Wednesday": 3100.00,
        "Thursday": 0,
        "Friday": 0,
        "Saturday": 0,
        "Sunday": 0,
        "WTD": 9350.00,
        "PTD": 54470.00
      },
      "ActualNetSales": {
        "SubHeader": "Actual Net Sales",
        "Monday": 2983.19,
        "Tuesday": 3728.17,
        "Wednesday": 3783.34,
        "Thursday": 0,
        "Friday": 0,
        "Saturday": 0,
        "Sunday": 0,
        "WTD": 10494.70,
        "PTD": 58022.00
      }
    },
"Transactions": {
      "Proj": {
        "SubHeader": "Proj",
        "Monday": 225.00,
        "Tuesday": 350.00,
        "Wednesday": 270.00,
        "Thursday": 0,
        "Friday": 0,
        "Saturday": 0,
        "Sunday": 0,
        "WTD": 845.00,
        "PTD": 4644.00
      },
      "Actual": {
        "SubHeader": "Actual",
        "Monday": 263.00,
        "Tuesday": 365.00,
        "Wednesday": 289.00,
        "Thursday": 0,
        "Friday": 0,
        "Saturday": 0,
        "Sunday": 0,
        "WTD": 917.00,
        "PTD": 4827.00
      }
    }
  }

So there are multiple dimensions with "SalesSummary" and "Transactions" as the top level dimension each having their own sub dimensions, each of which have the last layer which would be the row data that I'm trying to display. The reason I have the data structured this way is I actually need to display it on the page grouped by top level dimension, so "SalesSummary" then by the sub dimension within each top level. Is there a way to define a schema model to handle this when binding to a kendo grid? Or should I even be using a grid to display this type of data?

Best Regards,

Mike
Alex Hajigeorgieva
Telerik team
 answered on 18 Oct 2016
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
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?