Telerik Forums
Kendo UI for jQuery Forum
2 answers
245 views

Hello,

I am new to Kendo UI and I am having some trouble trying to create a window dialog with datepickers in it.

The first time I load it, it looks great.

Then I close it, open it again and the datepickers don't seem to load properly.

Can you help me or point me in the right direction?

Here's my code:

$("#button").click(function (e)
{
    e.preventDefault();
    var kendoWindow = $("<div />").kendoWindow(
    {
        open: function ()
        {
            var picker = $("#project_end_datepicker").data("kendoDatePicker");
            if (picker == null)
            {
                $("#project_end_datepicker").kendoDatePicker(
                {
                    animation: false
                });
 
                $("#project_start_datepicker").kendoDatePicker(
                {
                    animation: false
                });
            }
        },
        title: "Nieuw project",
        resizable: false,
        iframe: true,
        modal: true
    });
                  
    kendoWindow.data("kendoWindow")
    .content($("#new-project-dialog").html())
    .center().open();
});

 

Marc
Top achievements
Rank 1
 answered on 24 Jun 2016
1 answer
565 views

Hi,

I'm developing a large industry SPA portal on AngularJS and faced several issues with Grid filtering:

1. Column template supports AngularJS directives, but column filter "itemTemplate" isn't:

                   template: "<the-column value='#= TheColumnValue #'></the-column>",
                   filterable:
                    {
                        multi: true,
                        itemTemplate: function(e) {

                            // some conditions here
                            return "<the-column-filter></the-column-filter>";
                        }
                    }

In this code snippet GridColumn's template field works as expected (directive the-column is recognized), but the-column-filter directive, referenced in filter itemTemplate is not recognized and just ignored.

Even worse is that if I started providing filterable option, localization in this specific column resets to default language (en-US):

http://take.ms/Byorr

2. Another localization problem reproduced with "Is null" and "Is not null" operators. As opposed to other operators, these two have no translations to RU:

http://take.ms/zj2rV

But when I tried to provide my own translations for them, other criterias just disappeared:

http://take.ms/Q6wL2

Please, give me a hint to workaround these problems or fix them if possible.

Thank you

Alex Hajigeorgieva
Telerik team
 answered on 24 Jun 2016
3 answers
2.2K+ views
Hi
could you provide a sample code to debug javascript code ?
Thanks
Alexander Valchev
Telerik team
 answered on 24 Jun 2016
2 answers
276 views

Hi,

I have an issue with draggable ui element. I'm trying to achieve following:

 

- I have a widget that essentially a div (no plugins).

- I have an iframe inside that div.

- I applied draggable to that widget

$(widget).kendoDraggable({
                           hint: function (element) {
                               return element.clone();
                           }
                       });

I need to see widget when I drag it around. This is why I use 'hint' but because it's a copy of original iframe, it doesn't preserve it's state, it reloads the whole page again, and if user navigated inside the iframe, lets say he scrolled, it's not even the same look.

Is there any possibility that I can drag the same element but not the copy?

Thank you.

Sergey
Top achievements
Rank 1
 answered on 24 Jun 2016
1 answer
550 views

Hi,

Pressing the ESC key will normally close a kendo window. But when the kendo window contains an iframe, then pressing the ESC key wont close the window. For instance I have a kendo window containing an iframe, which in turn contains an input text component. Upon opening of the window the input text component gets the focus. Pressing the ESC button now won't close the window. Any suggestions on how to get this scenario working?

Regards,
Ron

Alex Gyoshev
Telerik team
 answered on 24 Jun 2016
3 answers
7.9K+ views
How do I right align currency in a grid cell?
Oren
Top achievements
Rank 1
 answered on 24 Jun 2016
4 answers
440 views
     1st Grid in a partial view which is rendering fine:

    @(Html.Kendo().Grid<OpenInvoicesInfo>()
      .Name("OpenInvoiceGrid")
      .ColumnMenu(i => i.Columns(false))
      .Columns(columns =>
      {
          columns.Bound(p => p.INVOICE).ClientTemplate("<input type='checkbox' value='#= INVOICE #' class='testclass'  />").Width(4);
          columns.Bound(i => i.INVOICE).Title("Invoice").Width(15);


    2nd grid rendering fine intially with initial given invoices but not sure how to get selected checkbox invocies from first grid and updated 2nd grid

    @(Html.Kendo().Grid<CustomerComments>()
      .Name("CustomerCommentsGrid")
      .ColumnMenu(i => i.Columns(false))
      .Columns(columns =>
      {
          columns.Bound(i => i.Invoice).Title("Invoice").Width(15);
          columns.Bound(i => i.Comment).Title("Comment").Width(40);

      }).Pageable(pageable => pageable
          .Refresh(true)
      )
      .Scrollable()
      .Sortable()
      .Filterable()
      .DataSource(dataSource => dataSource
          .Ajax().UseJniErrorHandler()
          .PageSize(10)
              .Read(read => read.Action("GetCustomerComments", "Maint"))
      )
)

    <script type="text/javascript">
        function GetAllInvoicesComments() {
            var result = [];
            var items = $("#OpenInvoiceGrid").find(".testclass").filter(":checked");
            items.each(function () {
                result.push({
                    Value: $(this).val(),
                    Checked: true
                });
            });

            $.ajax({
                url: webManager.resolveUrl("~/maint/GetCustomerComments"),
                //data:  
                method: "POST",
                data: { invoices:result},
                success: function () {
                    var grid = $('#CustomerCommentsGrid').data('kendoGrid');
                    grid.dataSource.read();
                    grid.refresh();
                },
                error: function () {
                    alert('an error occurred');
                }    
            });
        }

</script>

      2nd Grid's Controller - I am able to invoke and able to pass selected invoices in parameter:

        public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
        {   
            invoices = "'F300003634','F300003764'";//hard coding to see it first time     
            List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);

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

Problem is it is again getting called because of this .Read(read => read.Action("GetCustomerComments", "Maint")) and I don't want to call them 2nd time only call once when page is loaded initially.

Thank you.

Also wondering is it possible to update grid if it is in different partail view?
Right now just FYI 2nd partial view with 2nd grid (from 1st partial view) is not loading.
Gaurav
Top achievements
Rank 1
 answered on 23 Jun 2016
3 answers
714 views

I have 2 comboboxes that will be used to filter data in a kendo grid.  I am trying to filter the second combobox's data based on the selection from the first combobox.  Both comboboxes retrieve their data from Angular service methods.  The data is an array, and then I add an extra record at the beginning of each array in case no filter is requested.  In the select option of the first combobox, I have a method that will place a filter on the second combobox's dataSource.  It requires two filters due to including the extra record.  I have included an "or".  However, when I run the code, my filter is showing up with an "and".  Is it not possible to use two filters that filter on different fields with an "or"?

I am including the important parts of the code below. I was trying to follow the examples, but it just seems to use "and" for my filter.  

Thanks for any assistance on this!!

myService.availableCategories.get(
    null,
    function (data) {
        var results = data.results;
        results.unshift({
            categoryID: 0,
            categoryName: "All",
            sortOrder: 0
        });
        vmFilters.categoryOptions = {
            dataSource: new kendo.data.DataSource({
                data: results
            }),
            dataTextField: "categoryName",
            dataValueField: "categoryID",
            filter: 'contains',
            value: vmFilters.selectedCategory,
            select: function (e) {
                var dataItem = this.dataItem(e.item.index());
                onCategorySelect(dataItem.categoryID);
            }                   
        };
    },
    function (error) {
        console.log(error);
    });
 
myService.availableOptions.get(
    null,
    function (data) {
        vmFilters.optionListAll = data.results;
 
        var initialItem = {
            optionID: 0,
            optionName: "All"
            categoryID: 0
        };
        vmFilters.optionListAll.unshift(initialItem);
        vmFilters.optionOptions = {
            dataSource: new kendo.data.DataSource({
                data: vmFilters.optionListAll
            }),
            dataTextField: "optionName",
            dataValueField: "optionID",
            value: vmFilters.selectedOption 
        };
    },
    function (error) {
        console.log(error);
    });
 
 
function onCategorySelect(categoryID) {
    if (categoryID !== 0) {
      vmFilters.optionOptions.dataSource.filter({
          logic: "or",
          filters: [
           { field: "categoryID", operator: "eq", value: categoryID },
           { field: "optionID", operator: "eq", value: 0 }
           ]
      });
    } else {
        vmFilters.optionOptions.dataSource.filter({});
    }
    vmFilters.optionOptions.dataSource.read();
    console.log(vmFilters.optionOptions.dataSource);
}

Christy
Top achievements
Rank 1
 answered on 23 Jun 2016
2 answers
108 views

Hi,

I have a problem with Kendo Editor using AngularJs.

When I insert some empty lines (enter), and save, it adds ng-scope to the paragraphs. So when it reloads the value, the placeholder crashes.

Was wondering if you could help me with that.

Please take a look at the attached screenshot.

 

Thanks

 

Negin
Top achievements
Rank 1
 answered on 23 Jun 2016
5 answers
493 views

In a Kendo Grid, I have a column that contains a date.  I'm using this method for inserting my own control into the cell to edit the date:

function dateTimeEditor(container, options)
{
    console.log("options", options);
    $('<input data-text-field="' + options.field + '" '
      + 'data-value-field="' + options.field + '" '
      + 'data-bind="value:' + options.field + '" '
      + 'data-format="' + options.format + '" '
      + '/>')
        .appendTo(container)
        .kendoDateTimePicker(
        {
            format: "MM/dd/yyyy",
            parseFormats: [ "yyyy/MM/dd", "MM/dd/yyyy", ],
        });
} 

In the column definition I have this:

{
    field: "probeDate",
    title: "Probe Date",
    width: 60,
    format: "{0:MM/dd/yyyy}",
    editor: dateTimeEditor,
    attributes: { class: "editable-cell" },
}

So far this works great.  Now I wanted to add custom validation to this control, so in the model I have a field defined like this:

type: "date",
editable: true,
validation:
{
    validateProbeDate: function (input)
    {
        if (console != undefined) { console.log(input); }
 
        // Validate the probeDate as well as all of the dynamic fields.
        if (input.val().trim() === "" || parseDate(input.val()) == null )
        {
            input.attr("data-validateProbeDate-msg",
                       "Probe Date must be a valid date value (mm/dd/yyyy or yyyy/mm/dd).");
            return false;
        }
        // TODO: Make sure the date falls within the bounds of the probe.         
        // return new Date(input.val()) < probeStartDate...
 
        return true;
    }
}

This works as far as the validation as it doesn't allow me to leave the field unless my validation method returns true, but the error message won't show on the field and I've tried several methods to try to get it to show up.  I assume the problem is in dateTimeEditor() where I'm defining the date edit control.

You can see this in action in this fiddle: Probe Data Entry

Thanks in advance!
Scott
Top achievements
Rank 2
 answered on 23 Jun 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
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?