Telerik Forums
Kendo UI for jQuery Forum
13 answers
2.0K+ views

I have a Kendo UI Grid in Angular that includes several foreign keys.  For the most part, the columns' displays can be handled using the 'values' property for the column.  However, I have a column in which I want to display both text and a font awesome image based on the foreign key ID.  I assume this will need a template, but do not know what to enter in the template.  For this column, I want something similar to the following:

$ctrl.columns = [{
    field: 'typeId',
    title: 'Type',
    values: $ctrl.types,
    editor: typeComboboxEditor,
    template:
        '<div>' +
            '<i class={{dataItem.typeId.image}} aria-hidden="true"></i>' +
            '<br/>{{dataItem.typeId.text}}' +
        '</div>'
}, {
    field: 'text',
    title: 'Item',
    width: '500px'
},
// etc.
{
    command: [
        { name: "edit", text: "" },
        { name: "destroy", text: "" }
    ]
}];

Obviously, dataItem.typeId is not what I need to use to get to the image and text, but I do not know what to put here.  For a different column, I created a component and passed in the entire dataItem, but that seems overkill for this.  

Is there a simpler way to reach two fields of the parent table when using a foreign key?

Thanks!

Donny
Top achievements
Rank 1
 answered on 24 May 2019
3 answers
2.0K+ views
Does the Kendo Spreadsheet have the functionality to have a drop down list in a row like Excel?
Veselin Tsvetanov
Telerik team
 answered on 23 May 2019
5 answers
523 views
I have used hasChanges() to detect dirty flag in dataSource. But it behaves in strange way when we have 1 row inside Grid and if i we delete that still hasChanges() return false. 
              I have created DOJO demo https://dojo.telerik.com/alOHiyOV  
      What is official solution
Tsvetomir
Telerik team
 answered on 23 May 2019
5 answers
380 views

Hello,

I would like to be able to filter my chart according to dates. The problem is that the filter does not apply correctly. If I put the beach from May 1st to the end of May, I have dates of April and even February 2018 coming up. 

Here is an example Dojo (Normally I receive the datasource dynamically)

Thank you for your help. 

n/a
Top achievements
Rank 1
 answered on 23 May 2019
3 answers
419 views

I am looking for an example similar to this demo:

https://demos.telerik.com/kendo-ui/pdf-export/page-layout

 

However when there are more table rows I need a separate page.

I can get the pdf output working correctly (including page headers and footers), but the on-screen content does not match.

a) no second page on the screen (either to scroll or via pagination controls)

b) the page header/footer from the template I used in the drawDOM options are not on the screen

 

Any ideas how to do this?

 

thank you!

Veselin Tsvetanov
Telerik team
 answered on 23 May 2019
1 answer
2.5K+ views

I have a grid with filterable mode: "menu,row". If I filter the dates by equal; not equal; >; <= it doesn't work. All my date are set to dd.mm.yyyy but when I look to my console.log filter value is not set correctly (see code bellow). How can Have the correct format, without time?

filter: function(e) {
    if (e.filter == null) {
        console.log("filter has been cleared");
    } else {
        console.log(e.filter.logic);
        console.log(e.filter.filters[0].field);
        console.log(e.filter.filters[0].operator);
        console.log(e.filter.filters[0].value);
    }
},

 

Answer: 

and
dateReleve
eq
Wed May 08 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale)

 

 

My code to create column

function createColumn(columnNames,lang){
    return columnNames.map(function(value){
        var hasTemplate = value.template !== null;
        var isHidden = value.hidden == 1;
        var typeDate = value.type == "date";
        var isLink = value.type == "link";
        var hasAttributeClass = value.class_css !== null;
        return {
            field: value.field,
            title: value.title,
            format: typeDate ? "{0:dd.MM.yyyy}" : "",
            filterable: typeDate ? {
                cell: {
                    operator: 'contains',
                    showOperators: false,
                    template: function(args) {
                        args.element.kendoDatePicker({
                            culture: lang,
                            format: "dd.MM.yyyy",
                            parseFormat: "dd.MM.yyyy"
                        });
                    }
                },
                ui:function(element){
                    element.kendoDatePicker({
                        culture: lang,
                        format:'dd.MM.yyyy',
                        parseFormat: "dd.MM.yyyy"
                    })
                }
            } : {
                cell: { operator: 'contains', showOperators: false}
            }
    });
}

 

M< code to create model

 

function createModel(columnNames){
    var model = {};
    var fields = {};
    $.each(columnNames, function(index,value){
        var propType = value.type;
        if (propType === "number" ) {
            fields[value.field] = {
                type: "number"
            };
        } else if (propType === "boolean") {
            fields[value.field] = {
                type: "boolean"
            };
        } else if (propType === "date") {
            //fields[value.field] = kendo.parseDate(value.field, "dd.MM.yyyy");
            fields[value.field] = {
                type: "date",
                format: "{0:dd.MM.yyyy}"
            };
        } else {
            fields[value.field] = {
                type: "string"
            };
        }
    });
    model.fields = fields;
    return model;
}


This code, give me that : 

filter: function(e) {
    if (e.filter == null) {
        console.log("filter has been cleared");
    } else {
        console.log(e.filter.logic);
        console.log(e.filter.filters[0].field);
        console.log(e.filter.filters[0].operator);
        console.log(e.filter.filters[0].value);
    }
},
and
dateReleve
eq
Wed May 08 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale)

 

How can Have the correct format, without time?

Thank you for your help

Georgi
Telerik team
 answered on 22 May 2019
1 answer
222 views

I've been trying to use the PHP wrapper for UI and get the grid to display my JSON data. If I set $dataSource->data($json) where $json is the result from my call it works, but when I set it to $dataSource->transport($transport) where $transport contains my read transport I get no rows to display in the grid.

 

I'm using the CodeIgniter framework and have the require statements as part of my autoload, so they are there along with the requirements in the header.

 

Here is my code:

<?php

//$json = json_decode(file_get_contents(site_url('data/sys_settings/read')),true);
$transport = new \Kendo\Data\DataSourceTransport();

$create = new \Kendo\Data\DataSourceTransportCreate();
$create->url(site_url('data/sys_settings/create'))
     ->contentType('application/json')
     ->type('POST');

$read = new \Kendo\Data\DataSourceTransportRead();
$read->url(site_url('data/sys_settings/read'));

$update = new \Kendo\Data\DataSourceTransportUpdate();
$update->url(site_url('data/sys_settings/update'))
     ->contentType('application/json')
     ->type('POST');

$destroy = new \Kendo\Data\DataSourceTransportDestroy();
$destroy->url(site_url('data/sys_settings/destroy'))
     ->contentType('application/json')
     ->type('POST');

$transport->read($read)
       ->parameterMap(new \Kendo\JavaScriptFunction('function(data) {
              return kendo.stringify(data)
          }'));


$idField = new \Kendo\Data\DataSourceSchemaModelField('id');
$idField->type('number')
->editable(false)
->nullable(false);

$repId = new \Kendo\Data\DataSourceSchemaModelField('rep_id');
$repId->type('number')
->editable(false)
->nullable(false);

$col1Field = new \Kendo\Data\DataSourceSchemaModelField('key');
$col1Field->type('string')
->editable(false)
->nullable(false);

$col2Field = new \Kendo\Data\DataSourceSchemaModelField('val');
$col2Field->type('string')
->editable(true)
->nullable(true);

$model = new \Kendo\Data\DataSourceSchemaModel();
$model->addField($idField)
->addField($repId)
    ->addField($col1Field)
    ->addField($col2Field);

$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')
       ->errors('errors')
       ->model($model)
       ->total('total');



$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)
           ->pageSize(20)
->serverFiltering(true)
->type('odata')
           ->schema($schema);



$col1 = new \Kendo\UI\GridColumn();
$col1->field('key')
          ->width(120)
          ->title('Settings');

$col2 = new \Kendo\UI\GridColumn();
$col2->field('val')
          ->width(120)
          ->title('Value');

$command = new \Kendo\UI\GridColumn();
$command->addCommandItem('edit')
        ->addCommandItem('destroy')
        ->title('&nbsp;')
        ->width(250);

$grid = new \Kendo\UI\Grid('grid');
$grid->addColumn($col1,$col2,$command)
->dataSource($dataSource)
->addToolbarItem(new \Kendo\UI\GridToolbarItem('create'))
->editable('inline')
->sortable(true);


echo $grid->render();

 

 

 

here is my JSON being sent from the URL:

{"data":[{"id":"1","rep_id":"0","key":"default_country","val":"USA"},{"id":"2","rep_id":"0","key":"default_state","val":"CA"},{"id":"4","rep_id":"0","key":"default_account_type","val":"Customer"},{"id":"5","rep_id":"0","key":"default_title","val":null}],"total":4,"errors":null}

 

 

 

I'm not sure what I'm doing wrong, but I can't get it to work via the transport.  Any help would be greatly appreciated.

Phillip
Top achievements
Rank 1
 answered on 22 May 2019
1 answer
484 views
In kendo multiselect dropdown,the problem we were facing is -if we add a very big new skill which cannot be selected from existing,the kendo goes on increasing its width and also on adding a small new skill, the cursor goes the next line.Let me know your solution to the above problem.To solve this issue, we added a class kendo-width to the bootstrap div class col-xs-12 col-sm-6 col-md-6 col-lg-6 (see the image) and we get the kendo width on page load and resize and apply that value to the class -k-multiselect-wrap k-floatwrap so that the top problem can be solved.code- $( window ).on("load resize",function() {

  var kendoWidthResize = $(".kendo-width").width() -6;
    $(".customize-kendo .k-multiselect-wrap.k-floatwrap").css("width", kendoWidthResize);  
});
On resize we are getting the correct width but on load the width is not applied to the .k-multiselect-wrap class and the kendo looks like a small textbox(see image).How to solve this issue?
Dimitar
Telerik team
 answered on 21 May 2019
2 answers
203 views
I have used hasChanges() to detect dirty flag in dataSource. But it behaves in strange way when we have 1 row inside Grid and if i we delete that still hasChanges() return false. 
              I have created DOJO demo https://dojo.telerik.com/alOHiyOV  
      What is official solution
Tsvetomir
Telerik team
 answered on 20 May 2019
2 answers
241 views
I'm trying to using Kendo Grid Inline Edit with MVC3 c#.net. I'm using Kendo.Mvc.dll 2012.2.423.340. It shows the list of the usages correctly. But not working for Edit and Update. When I click on Edit, it shows html code instead of the value only.

For example, for the Approved Usage ID, which is int. It shows as below in the edit box.

%3cinput class="text-box single-line" data-val="true" data-val-number="The field ApprovedUsageID must be a number." data-val-required="The ApprovedUsageID field is required." id="ApprovedUsageID" name="ApprovedUsageID" type="text" value="0" /%3e%3cspan class="field-validation-valid" data-valmsg-for="ApprovedUsageID" data-valmsg-replace="true"%3e%3c/span%3e

Can anybody tell me what's wrong with my code or any tips for debugging? I'm new on Kendo UI. Feeling lost on debugging because there is no error message and can hardly find answer through google.

Alright, I figured it out. Thanks,
Tsvetomir
Telerik team
 answered on 20 May 2019
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
Drag and Drop
Map
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?