Telerik Forums
Kendo UI for jQuery Forum
8 answers
2.1K+ views
Lets say I have a grid:

var release_grid = $("#release_grid").kendoGrid({
  dataSource: dataSource,
  pageable: false,
  sortable: true,
  columns: [
    { field: 'primary', title: 'Primary?', width: '78px' },
    { field: 'iso_3166_1', title: "Country", width: '320px', editor: countryDropDownEditor, template: kendo.template($("#country_template").html()) },
    { field: 'release', title: "Release Date", format: '{0:yyyy-MM-dd}', width: '105px' },
    { field: 'certification', title: 'Certification', width: '105px', editor: certificationDropDownEditor, template: '#=certification#' },
    { command: [
      { name: "edit", text: { edit: "Save", update: "Save",  cancel: "Cancel" }, template: kendo.template($("#edit_template").html()) },
      { name: "destroy", template: kendo.template($("#delete_template").html()) }
    ], title: 'Edit' }],
  editable: {
    mode: 'popup',
    confirmation: 'Are you sure you want to delete this record?'
  }
});
Now for the 'certification' field, I would like it to do an AJAX call with the selected value from the 'iso_3166_1' value. How do I do this?

function certificationDropDownEditor(container, options) {
  $('<input data-text-field="certification" data-value-field="certification" data-bind="value:' + options.field + '"/>').appendTo(container).kendoDropDownList({
    autoBind: false,
    dataSource: {
      type: "json",
      transport: {
        read: '/country/certifications'
      }
    }
  });
}
I cannot figure out how to pull the selected row's 'iso_3611_1' value out to use in this AJAX call. Anyone got any pointers?
Boyan Dimitrov
Telerik team
 answered on 21 May 2015
2 answers
134 views

Hi all , I need some help with some issues in a custom editor I add to a kendo grid . I'm using MCV and the code is the following : 

   @(Html.Kendo().Grid<GridProspectObject>()    
       .Name("GridAllProspects")
       .AutoBind(false) 
        Events(events =>
         {
               events.DataBound("loadtooltipsAllProspectsGrid");
               events.Edit("onEditAssignment");
          })
          .Columns(columns => 
          {
                  columns.Bound(p => p.ProspectName).Title("name");

                  columns.Bound(p => p.Class).Title("class");

                   columns.Bound(p => p.DisplayStatus).Title("assignment status (click to change)").ClientTemplate("#=AssignedTo#").EditorTemplateName("EditorVolunteer").HtmlAttributes(new { @style = "text-align:left" });
          })
         .ToolBar(toolbar => 
        {
               toolbar.Save();        
         })
         .Editable(editable => editable.Mode(GridEditMode.InCell))
         .Pageable()
         .Sortable()
          .Filterable()
         .DataSource(dataSource => dataSource        
             .Ajax()         
             .Batch(true)
            . PageSize(50)
            .Model(model =>
            {
               model.Id(p => p.ProspectId);
               model.Field(p => p.ProspectName).Editable(false);
              model.Field(p => p.Class).Editable(false);
           })
          .Read(read => read.Action("Read_AllProspects", "Projects", new { listId = prospectList.PROSPECT_LIST_ID, pid = Model.PROJECTS_ID }).Type(HttpVerbs.Get))
.          Update(update => update.Action("ChangeAssignment", "Projects"))
         )
        .HtmlAttributes(new { @style = "margin-top:10px" })
   )

The editor template is a kendo comboBox : 

      @(Html.Kendo().ComboBox()
        .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
        .Filter("contains")
        .Placeholder("--select--")
        .DataValueField("Value")
        .DataTextField("Name")
        .Events( events =>
        {
            events.DataBound("dataBound");
            events.Open("openDropDown");
        })
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("ReadAsignmentOptions", "Projects").Data("getParentId") )
        )
        .Template("#if( data.Value == '" + Guid.Empty + "' || data.Value == '-1' ) {# " +
            "<span class='specialOption'>#:data.Name #</span>" +
            " #} else {# " +
            "<span>#:data.Name#</span>" +
            " #}#")
     )


Finally the "getParentId()" function is : 

  function getParentId() {
        var row = $(event.srcElement).closest("tr");
        var grid = $(event.srcElement).closest("[data-role=grid]").data("kendoGrid");
        var dataItem = grid.dataItem(row);
        return { prospectId: dataItem.ProspectId, currentAssigned: dataItem.AssignedToId };
    }

The issues I need help with are : 

 

 1) I want to add server filtering to the combobox so I can display a custom message "no results to display" when the text entered in the comboxbox returns no results but when I add the options "ServerFilter(true)" to the comboxbox the function getParentId() throws an error saying "cannot ready property dataItem of null".

 2) When a selection is made from the combobox (the same custom editor) , I want to display that selection with the red corner in the cell visible, so the user can see the change before saving . Right now when I select an option the old value keeps showing in the grid cell and only red icon appears. 

 3) This code works fine in IE  and Google Chrome , but for some reason it does not work in Firefox. When I click on the grid cell to edit it the combobox just spins forever because the request never gets to the controller. Is this a known bug ? 

 

Thanks !

 

 

Boyan Dimitrov
Telerik team
 answered on 21 May 2015
1 answer
156 views

When a row on a grid is clicked a popup form is opened. Inside the form I setup a Razor Kendo DropDownList from a database. I was able to mange the DropDownList to change HTML tables based on the drop down value. However, when the form is initially loaded I am not able to show the correct table in other words i am not able to get the value of the current displayed item. 

This is how I change tables when the user select different item in the menu:

    $(function () {
            $('#PaymentType_ID').change(function () {
                $('.payment').hide();
                if ($(this).val() == "5") {
                    $('.payment').hide();                    
                }

                if ($(this).val() == "2") {
                    $('#creditCardPayment').show();
                    $('#generalPayment').show();
                }

                if ($(this).val() == "1" || $(this).val() == "3" || $(this).val() == "4") {
                    $('#otherPayment').show();
                    $('#generalPayment').show();
                }
            });
        });

 

I want to reuse most of the code but instead of using on .change I want to use something like .ready but it does not work.

Anyone has any idea how should I try?

Victor
Top achievements
Rank 1
 answered on 21 May 2015
1 answer
62 views

I am not sure if this has been asked already. If yes, please point me to that thread. 

Use case: This happens when a row template is implemented in Grid. If the content of cell is edited and tab key is pressed, the focus jumps to next item. But the edited cell still maintains the editor.

Expected Behavior : As soon as tab is pressed and focus get shifted out of the edited cell, the cell should display in "normal" mode rather than edit mode.

Refer to this link for my implementation

http://dojo.telerik.com/@kamit1983/IREku/11

Thanks

Boyan Dimitrov
Telerik team
 answered on 21 May 2015
1 answer
671 views

Hi,

 I have a form with validations setup and everything works fine if user tries to enter something. If user directly clicks on the submit button after page load with out touching any field then validations wont fire.

 Take a look at the example here http://dojo.telerik.com/AXIsI/2

if you just go into the text box and tab out, then error message is displayed. if you directly click on the button with out touching then validation message is not displayed as the rules is skipped based on input name checking. How can make this work?

 I made the example to be simple, in real scenario there is so much complex logic involved. So I cannot avoid using check on name and also I cannot use just the html5 "required" attribute

Daniel
Telerik team
 answered on 21 May 2015
1 answer
577 views
Hello!

We have problem with "Upload" component.

It's looks like event "OnSuccess" on it (on Upload component) does not work.

We use asynchronous upload, and  Upload component is routed to web api controller method in which we process upload.

When everything went ok with upload we set response status code [OK] (200) and we also trying to sent some data as Content back to client.

Our server-side code (in method in ASP.NET Web API controller in which we process upload from Upload component) looks like:

HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StringContent("File was succesfuly uploaded");    
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain");
return response;

When we try do things this way, then Upload component on client-side activates OnError event instead of OnSuccess event. 

Why is that? And is there some workaround for this?


thanks,
Igor.

Dimiter Madjarov
Telerik team
 answered on 21 May 2015
5 answers
1.2K+ views
In kendo scheduler in week/month view when an appointment is created that has two day time span and if the scheduler has some default scroll.
Then if i want to select the appointment by clicking on that the scroll is happening to point to second day.Is there any way to avoid this.
 I want to handle the appoinrment click event.
Thanks in Advance
Dimo
Telerik team
 answered on 21 May 2015
1 answer
253 views

Hi,

Does the Upload control allow setting a minimum file size so that files below this limit won't be uploaded?

 

Thanks

Dimiter Madjarov
Telerik team
 answered on 21 May 2015
1 answer
274 views

We are unable to display the fetched data on the KendoGrid.  We are able to retreive the data from the service call and then call the datasource fetch() method to repopulate the grid, but the the grid is not displaying any data.

 Please refer to the code snippet below:

------------------------------------------------------------------------------------ 

// AngularJS Controller 

...

$scope.search = {
            timeout: null,
            delay: 500, //500ms
            query: '',        
        };

....

 $scope.applyFilter = function() {
            if (userType == "keheemployee") {
                //$scope.applyServerFilter();    //NOTE!!  This line of code works with ng-repeater

                //call the updateKendoDataSource function here...  
                updateKendoDataSource();  //NOTE!!  This line of code is for the actual Grid 

            } else {
                applyClientFilter();
            }
        };

 

// Note: Function which gets called when Filter button is clicked. 

function updateKendoDataSource() {

            var employeeGrid = $("#employeeGrid"); // employeeGrid id the Grid's id
            var employeeGridData  = employeeGrid.data("kendoGrid");

            if ($scope.search.timeout) {
                $timeout.cancel($scope.search.timeout);
            }
            $scope.search.timeout = $timeout(function () {               
                if ($('#searchText').val()) {
                    employeeGridData.dataSource.transport.read = {
                        url: landingPageAPIService.getSearchResultsData($('#searchText').val(), $scope.includeInactive),
                        type: "GET",
                        dataType: "json",
                        contentType: 'application/json; charset=utf-8',
                        cache: false                        
                    };
                    employeeGridData.dataSource.fetch();
                }
            }, $scope.search.delay);
        }

// AngularJS Service

var kVendorManagementServices = angular.module('kServices.apis.vendorManagement', ['kServices.connectApi']);

    kVendorManagementServices.service('landingPageAPIService', ['Services', 'vendorManagementEnvironment', landingPageAPIService]);

    return kVendorManagementServices;

    function landingPageAPIService(Services, vendorManagementEnvironment) {

        return {
            
            // All the API calls go here...                       
          getSearchResultsData: function (searchText, includeInactive) {              
              return Services.request("GET", vendorManagementEnvironment.apiVendorManagementServices('/api/LandingPage/Search/' + includeInactive + '/' + searchText));  //apiVendorManagementServices is created for us

        }, //end  getSearchResultsData function
                       
        };        
    }

 

View Template:

<div>
    <input id="searchText" ng-model="searchText" />
    <input id="includeInactive" type="checkbox" ng-model="includeInactive" /> &nbsp;
    <label>Include Inactive</label>
    <!-- Clear Filter button -->&nbsp;
    <input type="button" id="filterData" value="Filter" ng-click="applyFilter()" />
    <input type="button" id="clear" value="Clear Filters" ng-click="clearFilters()" />
</div>

<div id="employeeGrid" kendo-grid class="col-sm-12"
             k-data-source="landingPageData.Vendors"
             k-options="kendo.gridOptions" class="grid">
</div>

 

Kiril Nikolov
Telerik team
 answered on 21 May 2015
2 answers
64 views

Hi guys..

Well, my login view has some divs..almost all of them have margin/padding using "%"..

When I press some input text, the keyboard comes up and all divs are compressed..

How can I fix the view so it will not get stretched or compressed by keyboard appearances?

 

Regards.

 

André Rocha.

André
Top achievements
Rank 1
 answered on 21 May 2015
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
Licensing
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
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?