Telerik Forums
Kendo UI for jQuery Forum
1 answer
589 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
372 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.0K+ 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
898 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
183 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
170 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
181 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
371 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
170 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
4 answers
481 views

We allow users to specify custom symbols as part of the number formats they see in our software. We are using Kendo's formatting capability to incorporate these symbols as part of our format strings. For example, we might have a format string like:

var format = "\\$0.00\\/\\h\\r;(\\$0.00\\/\\h\\r)";

kendo.toString(-1.7, format); // ($1.70/hr)

Note the use of backslashes to escape literal characters in the format string. This seems to work well, except when the ? character is used. Here's an example:

var format = "\\?\\x0";

kendo.toString(100, format); // returns "x?100", but I would expect "?x100"

This definitely seems like a bug. I can't find any documentation (http://docs.telerik.com/kendo-ui/framework/globalization/numberformatting) explaining why the '?' character should receive special treatment at all, let alone when escaped.

I've also posted this as a StackOverflow question:

http://stackoverflow.com/questions/39977914/kendo-format-string-puts-literal-in-the-wrong-place

 

Mike
Top achievements
Rank 1
 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
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
ScrollView
Switch
TextArea
BulletChart
Licensing
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
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?