Telerik Forums
Kendo UI for jQuery Forum
1 answer
4.7K+ views

Hi,

I created a select list in my controller and then returned it as Json for the dropdown

Controller:

/// <summary>
        /// Prepare available cargo types
        /// </summary>
        /// <param name="items">Cargo Type items</param>
        /// <param name="withSpecialDefaultItem">Whether to insert the first special item for the default value</param>
        /// <param name="defaultItemText">Default item text; pass null to use default value of the default item text</param>
        public virtual IList<SelectListItem> PrepareAvailableCargoTypes(IList<SelectListItem> items, bool withSpecialDefaultItem = true, string defaultItemText = null)
        {
            if (items == null)
                throw new ArgumentNullException(nameof(items));
 
            var selectListItems = new List<SelectListItem>()
    {
            new SelectListItem() { Value = "1", Text = "Dry Bulk" },
            new SelectListItem() { Value = "2", Text = "Breakbulk" },
            new SelectListItem() { Value = "3", Text = "Project" },
            new SelectListItem() { Value = "4", Text = "FCL Container" },
            new SelectListItem() { Value = "5", Text = "LCL Container" },
            new SelectListItem() { Value = "6", Text = "Liquid Bulk" },
            new SelectListItem() { Value = "7", Text = "RoRo" },
            new SelectListItem() { Value = "8", Text = "Other" }
    };
 
            items = selectListItems;
 
            return items;
        }
 
 
 
public JsonResult GetAvailableCargoTypes()
        {
            var model = new CargoMasterModel();
            return Json(PrepareAvailableCargoTypes(model.AddCargoDetailModel.AvailableCargoTypes, false));
        }

Cshtml:

columns: [
                            {
                                    field: "CargoType",
                                    title: "Cargo Type",
                                    width: 200,
                                    editor: cargoTypeDropDownEditor,
                                    //template: "#= #"
                            },
 
//and function
 
function cargoTypeDropDownEditor(container, options) {
                            $('<input required name="' + options.field + '"/>')
                                .appendTo(container)
                                .kendoDropDownList({
                                    autoBind: false,
                                    dataTextField: "Text",
                                    dataValueField: "Value",
                                    dataSource: {
                                        serverFiltering: true,
                                        dataValueField: "Value",
                                        transport: {
                                            read: {
                                                type: "POST",
                                                dataType: "json",
                                                url: "@Html.Raw(Url.Action("GetAvailableCargoTypes", "CargoAdmin"))"
 
                                            }
                                        }
                                    }
                                });
                        }

 

So far dropdown editor works great, but displays only the value. How can I make the grid display Text value of my select list based on value?

Georgi
Telerik team
 answered on 01 Feb 2019
4 answers
144 views

Hi,

I saw that the Scss package has a different version than the kendo version. Is there a page where we see the connection between these 2?

What I mean is for example the @progress/kendo-theme-bootstrap@3.2.0 only work with versions starting from Kendo UI R1 2019

Or is it a guaranty that the latest version of the scss file works with any version of kendo?

Dan
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 01 Feb 2019
1 answer
160 views

Hi there. I'm new to the spreadsheet component and was wondering the following. Am I able to take two javascript arrays (converted to json) and populate one starting in cell B2 and populate the other starting in cell J5, for example?  I couldn't find a way to dictate the starting cell using 'datasource' and couldn't find a way to add multiple data sets into one worksheet. Thanks. 

Marin Bratanov
Telerik team
 answered on 01 Feb 2019
12 answers
1.1K+ views
I am a beginner working on Kendo Grid. I wanted to load the data on demand in the grid, like :

- I set the page size to 50, when a user scrolls down to 50 rows, the
grid should retrieve next 50 rows from database and display it on
demand.To do this, I changed "scrollable: true" to "scrollable: {virtual: true}". But this disables scrolling in the grid.

- I am stuck, let me know if anyone has faced the same issue and found any solution for it.
Here is my code

=================================================

var managecustomerGrid = $("#customerGrid").kendoGrid({
     dataSource: {
        schema: {
         data: "results",
         total : "totalRecords",
         model: {
            id: "SRNUMBER",
            fields: {
              SRNUMBER : {type: 'number'},
              CUSTOMERNAME : {type: 'string'},
              DATEPAID : {type: 'string'}
              }
           }
         },
         serverPaging: true,
         serverSorting: true,
         serverFiltering: true,
         pageSize: 20,
         batch: false,
         transport: {
             read: {
                 type: "POST",
                 url: "/customer/customer.cfc",
                 dataType: "json",
                 error: function (xhr, error) {
                          alert('Error In Getting Customer Information.');
                     }
             },
             parameterMap: function(options, type) {
                  return {
                        ntPageNumber: options.page,
                        ntRowLimit: options.pageSize,
                        ntskip: options.skip,
                        vcSortOrder: JSON.stringify(options.sort),
                        vcFilterCondition: JSON.stringify(options.filter)
             }
         }
     }
},
toolbar: kendo.template($("#template").html()),
height: 600,
scrollable: {
      virtual: true
   },
filterable: {
       operators: {
             string: {
                  contains: "Contains",
                  startswith: "Starts with",
                  endswith: "Ends with",
                  eq: "Is equal to",
                  doesnotcontain: "Doesn't contain"
             }
      }
},
sortable: true,
columns: [
       { field: "SRNUMBER", title: "SR No.", width: "80px", template: "<span id='#=SRNUMBER#'>#=SRNUMBER#</span>"},
       { field: "CUSTOMERNAME", title: "Customer Name", width: "110px"},
       { field: "DATEPAID", title: "Date", width: "110px"},
       { command: ["edit","detail","cancel"], title: "&nbsp;", title: "Actions", width: "130px", filterable: false, sortable: false}
    ]
});

========================================================

Thanks for your help.

Natasa
Top achievements
Rank 1
 answered on 01 Feb 2019
2 answers
192 views

Hi all,

We are currently in a server migration procedure, which resulted in unexpected complications. In consequence, the Bower authentication procedure is failing. The responsible team is working on that issue for the past several hours. We will update the current thread with more details when we have them.

Please, excuse us for the caused inconvenience and thank you for your patience! 

Henrik
Top achievements
Rank 1
 answered on 31 Jan 2019
3 answers
2.3K+ views

Hi I am trying to set the title of my dialog window dynamically but get an error 

Uncaught TypeError: Cannot read property 'title' of undefined     
Nencho
Telerik team
 answered on 31 Jan 2019
3 answers
2.2K+ views

Hello, I have buil a grid in my app and I need to filter the grid using different criteria from outside the grid. I attach an scrrenshot to clarify my issue:

 

I need to select something on the combobox and filter it on the client side, as well as write something on the text box and filter teh grid below.

 

Thank you!

Konstantin Dikov
Telerik team
 answered on 31 Jan 2019
3 answers
672 views
Hello,
I have problem with the confirm dialog in change event for combobox.

Link: https://dojo.telerik.com/UhEpeZod/6
 
The problem appears when I put any new text into the combobox and press enter. Why is the done function executed first and no confirm dialog shows? Is it a bug?

 Thank you and kind regards
Dimitar
Telerik team
 answered on 30 Jan 2019
3 answers
1.3K+ views

Hello

I'm not sure if I'm right here but I couldn't find a topic for kendoDialog...

I have a dialog mask in my application (KendoUI, Javascript/JQuery) with two buttons: "Ok" and "Cancel". I would like to set the focus to the "Ok" button by default or at least when the dialog window is opened. I tried different things like setting .focus() on the first found .k-button, I tried to simulate a TAB command (that sets the focus to the "OK" button doing this by keyboard) on kendoDialog event "open", but everything around that didn't work. I assume that .focus() doesn't work because its not an official HTML button.

Is there a (simple) way to set the focus in a kendoDialog to a button?

Regards

Veselin Tsvetanov
Telerik team
 answered on 29 Jan 2019
4 answers
348 views
Is there a way to auto fit all of the columns? Or do I just have to go through and set a specific width on all of the columns?
Maxwell
Top achievements
Rank 1
 answered on 29 Jan 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?