Telerik Forums
Kendo UI for jQuery Forum
3 answers
1.2K+ views

Hello,

I am having issues trying to get a validation to fire off on one of the fields of my data grid. This is the JSFiddle that is essentially what I've got so far:

https://jsfiddle.net/qct05yvy/24/

The title column has a validation that it is < 50 characters. This is correctly firing if I add that amount of characters.
The Start Date/End Date column have an on change function that gets the time (in days) between the two using momentjs and then it updates the Duration column. The issue is that it allows a negative duration (meaning you set the end date to a date before the start date) and causes some issues with the calculation I do on the backend.

I can prevent the user from submitting it to the backend by changing the update method in the datasource, but then I can't throw an error message like the one that happens when you add > 50 characters in the Title field (no, a Javascript alert will not work in my case unfortunately).

I need to be able to either make this validation actually fire correctly and correctly display the message or be able to prevent the user from selecting a date before the startDate DatePicker (which I spent several hours researching and found no way to do this programatically. I know I can set the Min, but how do I re-set the Min whenever they select a new startDate?).

Can anyone help me out? Thank you for your time!

-Ken

Georgi
Telerik team
 answered on 22 Feb 2018
1 answer
7.6K+ views

Hello,

   I am having three issues with a modal pop up window.  The first is the most annoying one, periodically I will get the following message when I hit a button to open the window. 

Line: 82
Error: Unable to get property 'center' of undefined or null reference

 

    Now if I switch the center to after open it then gives me the same error with open instead of center.  Then if I switch them back it works perfectly fine.  Here is the code from the page to show you what I mean:

<br />
@(Html.Kendo().Window()
.Name("SelectD")
.Title("Select a Charcter")
.Content("Loading information.....")
.LoadContentFrom("Index", "Characters")
.Modal(true)
.Visible(false)
.Width(500)
.AutoFocus(true))
<span id="selD" class="btn btn-default">Delete Character</span>
<script>
$(document).ready(function () {
$("#selD")
.bind("click", function () {
$("#SelectD").data("kendoWindow").center().open();
});
});
</script>

  I have the above in two places with only the id and name being different between the two, they both reference the same partialview.  It is annoying because I do not know when it will break on me.

The second issue is closing this modal window.  I have a select and a cancel button defined in the partialview.  The code is as follows:

<script>
$('#SelChar').click(function (e)
{
e.preventDefault();
window.top.location.replace = '@Url.Action("Edit", "Characters")' + '?id=' + $('#Char_ID').val();
window.close();
});
</script>
<a id="SelClose" class="btn btn-danger">Cancel</a>
<script>
$('#SelClose').click(function ()
{
window.close();
});
</script>

    Now the SelChar script works perfectly fine, it closes the modal window and navigates to the proper page.  The SelClose does not, it closes out all windows.  How do I get it to close only the modal window?

   The last issue is without using iframes, how do I get the background of the modal window to be the color I am looking for?  In my partialview the body tag has a style of background-color:grey, but all I get is a white background.  When I had iframes I would get the background color, but I was also getting the navbar which I did not want.

Dimiter Topalov
Telerik team
 answered on 21 Feb 2018
2 answers
738 views
Hello,
I have a problem with Kendo Scheduler doing a vertical auto-scroll.
For example, I want to change the end of an event by dragging it with the mouse. So I'm going to hit the bottom of the event (screenshot 1 - before-click.jpg).
As soon as I hit the mouse button, the event goes away. Scheduler performs the scroll so that the top edge of the event is visible.
When the event is too "long", so it does not fit into Scheduler, so after the "jump" the bottom edge disappears (screenshot 2 - after-click.jpg).
If I want to change this "long" event, I have to do it using the standard popup editing window.
Is it possible to turn off this vertical auto-scroll at Kendo Scheduler?
Thanks!
Jan Hron
Ivan Danchev
Telerik team
 answered on 21 Feb 2018
3 answers
326 views

Hi,

I created a Grid with Filter Row and using ajax:

@(Html.Kendo().Grid<Products>()
    .Name("grid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(10)
        .ServerOperation(true)
        .Model(model => model.Id(p => p.Id))
                  .Read(read => read.Action("GetList", "CurrentController").Data("HandleFilters")).PageSize(10)
    )
    .Columns(columns =>
    {
        columns.Bound(model => model.Name).
            Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")).
                Operators(m => KendoUICustomLocalization.GridFilterLocalization(m)));
        columns.Bound(model => model.LastName).
            Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")).
                Operators(m => KendoUICustomLocalization.GridFilterLocalization(m)));
         
         
    })
    .Pageable(p => p.Messages(m => KendoUICustomLocalization.GridPageLocalization(m))
    .PageSizes(10))
    .Sortable() // Enable sorting
    .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
    .Excel(excel => excel
        .FileName("Excel.xlsx")
        .Filterable(true)
        .AllPages(true)
        .ProxyURL(Url.Action("Excel_Export_Save", "CurrentController"))
    )
    .Events(events => events.Change("onGridChange"))
    )

 

 and the GetList action:

public ActionResult GetList([DataSourceRequest]DataSourceRequest request, string filtro_texto)
        {
            IQueryable<Products> products = _uow.GetProducts();
 
            .............
 
            DataSourceResult result = products_model.ToDataSourceResult(request);
            return Json(result, JsonRequestBehavior.AllowGet);          
        }

I see that the GetList action is called two times, one with the request pageSize = 0, and other with the request pageSize = 10

Is there any problem in my code? Is it a nomal behaviour?

 

Best regards

Stefan
Telerik team
 answered on 21 Feb 2018
4 answers
602 views
My application has a lot of windows, containing forms and other views of data that have been bound to observables, using the kendo.bind function.  Many of these windows are created and destroyed, over the course of the application lifetime.

My question is this:  Is it necessary to call kendo.unbind on the contents of these windows, prior to destroying them, or will they automatically clean up their observable bindings?

Also, are there any other best practices I should be aware of, for tidying up after deleting these form windows?
Peter
Top achievements
Rank 1
 answered on 21 Feb 2018
4 answers
677 views

Hello,

 

I am in need of a custom editor for the Gantt task because I need to validate and/or have a dropdown for a field. I can see how to achieve that by following https://docs.telerik.com/kendo-ui/api/javascript/ui/gantt#configuration-editable.template but that doesn't show me how I can get the resource editor to work. Neither have I found anything from searching the Internet or these forums.

 

So my question is, how to achieve the normal resource editor for Gantt tasks while using a custom editor template?

Rami
Top achievements
Rank 1
Veteran
 answered on 21 Feb 2018
7 answers
531 views

I'm using the scheduler with server filtering and I'm trying to get the next start date & end date of the scheduler view but i can't figure it out.

i'm not using ASP/C# so i need a JS example of how to do this. Every example i've found has just linked to a visual studio project, which is no good for me.

Tyler
Top achievements
Rank 1
 answered on 20 Feb 2018
1 answer
2.1K+ views

Hi, 

I am trying to set up a kendo grid for my asp.net core application but running into 'kendoGrid is not a function' error. Please see attached snap shot for the error and script references that i have included in my file. 

Thanks!

 

 

 

Georgi
Telerik team
 answered on 20 Feb 2018
2 answers
634 views

Hi, 

I am having a requirement to get sum and average of selected items (cells of specific numeric columns) of a grid in either an alert , Field or popup

Such as in the below example I want to get the average and Sum of selected Frieght columns

eg: https://demos.telerik.com/aspnet-mvc/grid/selection

I am not able to find the event for selectable: "multiple cell"

And also I want to allow this feature only on numeric fields. Please suggest the possible solution for this.

 

Shashank
Top achievements
Rank 1
 answered on 20 Feb 2018
1 answer
1.2K+ views

Hi,

I have a Grid With Master-Detail logic implemented which works just fine except 2 things:

 

1.) detailInit gets called every time I expand a row. Why? Can this be changed?

 

2.) If the detail grid has no data to show due to filtering I would like to remove the detail grid completely and show a text message instead "no Data".

I also want to get rid of the columns etc...so the complete Grid should disapear.

 

My MasterGrid and DetailGrid is defined as:

$("#kendoGefahrstoffGrid").kendoGrid({
    groupable: true, //Können die Records per Drag and Drop grupiert werden?
    sortable: true, //Dürfen die Spalten sortiert werden oder nicht
    scrollable: false,
    resizable: true,
    detailInit: detailInit,
    dataBound: function() {
 
        this.expandRow(this.tbody.find("tr.k-master-row"));
         
    },
    columnMenu: true, //Zeigt ein Menü an um Sortierung vorzunehmen oder eine Spalte ein bzw. auszublenden
    toolbar: kendo.template($("#toolbarTemplateGefahrstoff").html()),
    columns: [{
        field: "ID",
        title: "ID",
        width: 50
    },
    {
        field: "SelGefarhrstoff.Title",
        title: "My Gefahrstoff Title"
    },
    {
        field: "SelGefarhrstoff.Modified",
        title: "CheckDate"
    }, {
        field: "SelGefarhrstoff.CMR_Kat",
        title: "CMR Kategorie"
    }, {
        command: [{
            text: "Edit",
            click: editItem,
            iconClass: "k-icon k-i-edit"
        }],
        title: "Actions",
        width: "120px"
    }, {
        command: [{
            text: "create $18",
            click: createp18,
            iconClass: "k-icon k-i-file-add"
        }],
        title: "§18 Action",
        width: "120px"
    }
    ],
    dataSource: dataSourceGefahrstoff
}); //kendoGefahrstoffGrid

 

function detailInit(e) {
 
    dataSourceSelectedBAsDetails = new kendo.data.DataSource({
        schema: {
            model: {
                id: "ID"
            }
        },
        transport: {
            read: function (options) {
                $pnp.sp.web.lists.getByTitle("SelectedBAs").items
                    .select("*,UniqueId,FieldValuesAsText")
                    .expand("FieldValuesAsText")
                    .filter("INGAId eq " + currentINGA)
                    .get()
                    .then(function (items) {
                        console.log("SelectedBAs results:", items);
                        options.success(items);
                    }) //then function
                    .catch(function (e) {
                        console.log(e);
                        options.error(e);
                    }) //catch function
            } //read function
        }, //transport
        filter: { field: "GefahrstoffbezugId", operator: "eq", value: e.data.SelGefarhrstoff.Id }
    }); //datasource
 
 
    $("<div/>").appendTo(e.detailCell).kendoGrid({
        dataSource: dataSourceSelectedBAsDetails,
        noRecords: {
    template: "No data available"
  },
        columns: [{
            field: "ID",
            title: "ID",
            width: 50
        }, {
            field: "OData__dlc_DocIdUrl.Url",
            title: "Doc",
            template: '<a href="#=OData__dlc_DocIdUrl.Url#">Details</a>'
        },
        {
            command: [{
                text: "Edit",
                click: editItem,
                iconClass: "k-icon k-i-edit"
            }, {
                text: "view",
                click: showDocInBrowser,
                iconClass: "k-icon k-i-file"
            }],
            title: "Actions",
            width: 240
        }
        ]
    });
}

 

Stefan
Telerik team
 answered on 20 Feb 2018
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?