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

I am generating several dropdown lists dynamically in a modal when the user clicks a button. The number of dropdownlists varies depending on the data associated with the button click. I want the user to be able to tab from field to field and have the list automatically open when the user tabs into the field. When the user clicks on the field I want it to toggle open or closed still though. Currently, I added an onFocus event

$('.js-k-item-dropdown').on('focus', function (evt) {
        let elementID = $(evt.target).find('input').attr('id');
        let dropdown = $(`#${elementID}`).data("kendoDropDownList");
        dropdown.open();
    });

This works when the user tabs to the field but when the user clicks on another dropdown list the list opens and closes immediately. How do I prevent this behavior?

Ivan Danchev
Telerik team
 answered on 14 Jan 2020
12 answers
1.1K+ views

Hi,

I have a grid with transport.read.data specified to a javascript function to call. This isn't working as it doesn't ever call the function in javascript. Any help here would be great.

            $("#mailingListGrid").kendoGrid({
                dataSource: {
                    autoBind: false,
                    transport: {
                        read: "@Url.Action("GetCustomersJson", "MailingList")",
                        type: "jsonp",
                        data: additionalData
                    },
                    pageSize: 40,
                    schema: {
                        id: "KeyCustomer",
                        model: {
                            fields: {
                                CustomerName: { field: "CustomerName", type: "string" },
                                CustomerContact: { field: "CustomerContact",type: "string" },
                                ShipAddress1: { field: "ShipAddress1",type: "string" },
                                ShipCity: { field: "ShipCity",type: "string" },
                                ShipState: { field: "ShipState",type: "string" },
                                ShipZipCode: { field: "ShipZipCode",type: "number" },
                                IsShipTo: { field: "IsShipTo",type: "number" },
                                IsBillTo: { field: "IsBillTo",type: "number" },
                                KeySalesOrg: { field: "KeySalesOrg",type: "number" },
                                KeySendBillsTo: { field: "KeySendBillsTo",type: "number" },
                                DoubleUnitsBooked: { field: "DoubleUnitsBooked",type: "number" },
                                SingleUnitsbooked: { field: "SingleUnitsBooked",type: "number" }
                            }
                        }
                    }
                },
                height: 550,
                sortable: true,
                noRecords: {
                    template: "Please Select a Name to continue"
                },
                pageable: true,
                selectable: false,
                columns: [{
                    template: "<div" +
                    "style='');'><input class='checkboxSelector' type=\"checkbox\"/></div>",
                    field: 'field', headerTemplate: "<input id='checkboxHeader' onclick='checkAll()' type='Checkbox'/>",
                    width: 50,
                    sortable: false,
                }, {
                    field: "CustomerName",
                    title: "Customer Name",
                    width: 240
                }, {
                    field: "ShipAddress1",
                    title: "Address"
                }, {
                    field: "ShipCity",
                    title: "City"
                }, {
                    field: "ShipState",
                    title: "State",
                    width: 150
                }, {
                    field: "ShipZipCode",
                    title: "Zip Code"
                }],
                change: function (e, args) {
                    var grid = e.sender;
                    var items = grid.items();
                    items.each(function (idx, row) {
                        var idValue = grid.dataItem(row).get(idField);
                        if (row.className.indexOf("k-state-selected") >= 0) {
                            selectedOrders[idValue] = true;
                        } else if (selectedOrders[idValue]) {
                            delete selectedOrders[idValue];
                        }
                    });
                },
                dataBound: function (e) {
                    var grid = e.sender;
                    var items = grid.items();
                    var itemsToSelect = [];
                    items.each(function (idx, row) {
                        var dataItem = grid.dataItem(row);
                        if (selectedOrders[dataItem[idField]]) {
                            var currentRow = grid.tbody.find("tr[data-uid='" + dataItem.uid + "']");
                            currentRow.toggleClass('k-state-selected');
                            currentRow.find('input:checkbox').prop('checked', 'checked');

                            itemsToSelect.push(row);
                        };
                    });

                    //e.sender.select(itemsToSelect);
                },
            });

 

        function additionalData() {
            var value = $("#dsmList").data("kendoDropDownList").value();
            return { dsm: value };
        };

 

Not sure what exactly is going wrong here. Any help is appreciated.

Dimitar
Telerik team
 answered on 14 Jan 2020
3 answers
1.3K+ views

Fails to compile on using the simplest of grid implementations as follows. (But the same works on a react JS implementation)
The attached image has a screen shot of the implementation.
Code is as follows for the react component.

import { connect } from 'react-redux';
import * as redux from 'redux';
import * as projectActions from '../../redux/actions/projectActions';
import * as authorActions from '../../redux/actions/authorActions';
import * as React from 'react';
import { bindActionCreators } from 'redux';
import { Project } from '../../interfaces/Project';
import { ApplicationState } from '../../redux/reducers/initialState';
import { Grid } from '@Progress/kendo-react-grid';
 
interface OwnProps {
 
}
 
 
type ReduxProps = ReturnType<typeof mapStateToProps> & ReturnType<typeof mapDispatchToProps>;
// type Props = StateFromProps & DispatchFromProps & NavbarComponentProps;
interface Pprops extends ReduxProps {
    handleDeleteProject1: (project: Project) => void
}
 
class ProjectsPage extends React.Component<Pprops, any> {
 
    state = {
        redirectToAddProjectPage: false
    };
 
    componentDidMount() {
    }
 
    handleDeleteProject1 = async (project: Project) => {
    }
 
    render() {
        return (
            <>
                <Grid></Grid>
            </>
        );
    }
}
 
function mapStateToProps(
    state: ApplicationState
    , ownProps: OwnProps
) {
    const projectsList = state.projectsStateSlice.projects;
    return {
        projects:
            projectsList.map(project => {
                const authorNamee = project.authorId.toString();
                return {
                    ...project,
                    authorName: authorNamee
                };
            }),
        authors: state.authorsStateSlice.authors,
        loading: 0
    };
}
 
function mapDispatchToProps(dispatch: redux.Dispatch) {
    return {
        actions: {
            loadProjects: bindActionCreators(projectActions.loadProjects, dispatch),
            loadAuthors: bindActionCreators(authorActions.loadAuthors, dispatch),
            deleteProject: bindActionCreators(projectActions.deleteProject, dispatch)
        }
    };
}
 
// prop types declarations
export default connect(mapStateToProps, mapDispatchToProps)(ProjectsPage);

 

Throws the following error:

./src/components/projects/ProjectsPage.tsx
Cannot find file: 'main.js' does not match the corresponding name on disk: '.\node_modules\@Progress\kendo-react-grid\dist\es\@progress'.

When I dig into the node modules' directory that its claiming to throw the error from,

looks like this
.\node_modules\@Progress\kendo-react-grid\dist\es\main.js

it doesn't apparently contain any directory called @progress inside of the es (.\node_modules\@Progress\kendo-react-grid\dist\es\@progress)

FYI: I also am a licensed developer. 

Is this something to do with the licensing of the kendo UI by any chance?

My package.json is as follows:

{
  "name": "cncy-react-redux",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "start:dev": "react-scripts start",
    "prestart:api": "node tools/createMockDb.js",
    "start:api": "node tools/apiServer.js",
    "test": "jest",
    "start": "run-p start:api start:dev"
  },
  "jest": {
    "setupFiles": [
      "./tools/testSetup.js"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|mp3|wav|m4a|aac|oga)$": "<rootDir>/tools/fileMock.js",
      "\\.(css|less)$": "<rootDir>/tools/styleMock.js"
    }
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.26",
    "@fortawesome/free-regular-svg-icons": "^5.12.0",
    "@fortawesome/free-solid-svg-icons": "^5.12.0",
    "@fortawesome/react-fontawesome": "^0.1.8",
    "@reduxjs/toolkit": "^1.2.1",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "@types/bootstrap": "^4.3.1",
    "@types/enzyme": "^3.10.4",
    "@types/jest": "^24.0.24",
    "@types/node": "^12.0.0",
    "@types/react": "^16.9.0",
    "@types/react-dom": "^16.9.0",
    "@types/react-redux": "^7.1.5",
    "@types/react-router-dom": "^5.1.3",
    "@types/react-toastify": "^4.1.0",
    "@types/redux": "^3.6.0",
    "@types/redux-immutable-state-invariant": "^2.1.1",
    "@types/redux-thunk": "^2.1.0",
    "@types/reselect": "^2.2.0",
    "bootstrap": "^4.4.1",
    "immer": "2.1.3",
    "node-sass": "^4.13.0",
    "prop-types": "15.7.2",
    "react": "^16.12.0",
    "react-bootstrap": "^1.0.0-beta.16",
    "react-dom": "^16.12.0",
    "react-redux": "^7.1.3",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.3.0",
    "react-toastify": "^5.4.1",
    "redux": "^4.0.4",
    "redux-immutable-state-invariant": "^2.1.0",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "typescript": "~3.7.2",
    "@progress/kendo-data-query": "1.5.2",
    "@progress/kendo-date-math": "1.5.1",
    "@progress/kendo-drawing": "1.6.0",
    "@progress/kendo-react-animation": "3.9.0",
    "@progress/kendo-react-buttons": "3.9.0",
    "@progress/kendo-react-data-tools": "^3.9.0",
    "@progress/kendo-react-dateinputs": "3.9.0",
    "@progress/kendo-react-dialogs": "3.9.0",
    "@progress/kendo-react-dropdowns": "3.9.0",
    "@progress/kendo-react-excel-export": "3.9.0",
    "@progress/kendo-react-grid": "3.9.0",
    "@progress/kendo-react-inputs": "3.9.0",
    "@progress/kendo-react-intl": "3.9.0",
    "@progress/kendo-react-layout": "3.9.0",
    "@progress/kendo-react-pdf": "3.9.0",
    "@progress/kendo-react-popup": "3.9.0",
    "react-transition-group": "4.3.0"
  },
  "devDependencies": {
    "enzyme": "^3.9.0",
    "enzyme-adapter-react-16": "1.11.2",
    "fetch-mock": "^8.1.0",
    "jest": "^24.9.0",
    "json-server": "0.14.2",
    "node-fetch": "^2.3.0",
    "npm-run-all": "4.1.5",
    "react-test-renderer": "16.8.4",
    "react-testing-library": "^6.1.2",
    "redux-immutable-state-invariant": "2.1.0",
    "redux-mock-store": "^1.5.3",
    "rimraf": "2.6.3",
    "style-loader": "0.23.1"
  },
  "eslintConfig": {
    "extends": "react-app",
    "settings": {
      "react": {
        "version": "detect"
      }
    },
    "root": true
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

 

Stefan
Telerik team
 answered on 14 Jan 2020
4 answers
2.1K+ views
Quick question: is there a way set the valueAxis min and max based on the series data? For example I want the min to be 25 less than the minimum value present in my data set and I want the max to be 25 more than the maximum value in my data set?

Thanks in advance.
Alex Hajigeorgieva
Telerik team
 answered on 13 Jan 2020
3 answers
1.2K+ views
Is it possible to upload a file and have the content of the file be shown in the grid? The file will have 3 columns and will never change, I want to upload this file and have the columns in the file to be shown in the grid to the user.
Petar
Telerik team
 answered on 13 Jan 2020
5 answers
375 views

Does the css data binding work with kendo buttons? 

<button type="button"
aria-label="Thumbs up"
data-role="button"
data-bind="events: { click: thumbsUp }, css:{k-state-active: isThumbsUp}">
<i class="icon-thumbs-up icon-large"></i>
</button>

Ivan Danchev
Telerik team
 answered on 13 Jan 2020
3 answers
3.3K+ views

I have been struggling to understand a data-bind behavior of a dropdownlist control. I bound the source to an observable array of objects (with Text and Field properties). I want to bind the data-text-field to the Text property of the object and data-value-field to the object itself (not to it's Value property).

I tried several options:

Option1:

<select data-role="dropdownlist" data-bind="source: dropDownData, value: selectedValue" data-text-field="Text" data-value-field="this"></select>

SelectedValue is the whole object as a string "[object Object]". Not what I want.

Option2:

<select data-role="dropdownlist" data-bind="source: dropDownData, value: selectedValue" data-text-field="Text" data-value-field="this"></select>

SelectedValue is Text property of the bound object. Not what I want.

Option3:

https://jsfiddle.net/jakubjenis/z1o3L6hd/17

<select data-role="dropdownlist" data-bind="source: dropDownData, value: selectedValue" data-text-field="Text" data-value-field="Value"></select>

Weirdly enough this works. SelectedValue is the whole bound object (with Text and Value properties), but why? This should bind the Value property of the bound object, not the object itself.

Could you please explain what the correct way to set the data-value-field is so that the value field is bound to the whole object? 

Thanks,
Jakub

 

 

Petar
Telerik team
 answered on 13 Jan 2020
3 answers
328 views

Hi, 

To expand on my title a bit, I have a Upload widget which doesnt allow multiple files, and validates that uploaded documents are pdf's under 4Mb.

The problem is that when a new file is uploaded to replace the existing one, the Upload widget will make a call to delete the existing document, ONLY THEN will it validate the new one. How can I trigger the validation before the delete? This would prevent my users from inadvertently deleting the previous document, if the new one is not valid.

Thanks,
Grant

Petar
Telerik team
 answered on 10 Jan 2020
8 answers
606 views
Hi There,

Is there possibly a databind functionality for the Scroll View control that you could call similarly to the ListView for example:

$("#myscrollview").kendoMobileScrollView({
            template: "<div>${data.foo}</div>",
            dataSource: kendo.data.DataSource.create([{ foo: "bar" }, { foo: "baz" }])
        });

It would help me huge amount if this was available however if not are there any recommendations regarding using templates or external databinding with the scroll view?

Thanks!

Rob
Tsvetomir
Telerik team
 answered on 09 Jan 2020
3 answers
145 views

Background

I have a Kendo autocomplete that should display a list of "recently searches" on focus. To accomplish this, I wired up a focus event, where I autocomplete.search(''). This reliably displays the default list (whole list on local datasource and whatever my server returns on empty string with a remote datasource). However, we also wish to enable the suggest option, so upon focus, the autocomplete empty searches, and suggests the first option.

IE 11 Issue
This is where the first issue occurs. On IE11, our first search is triggered, and does as anticipated (shows list, and suggests the first option). However, a second search is also fired, but uses the suggestion as the search criteria.

This can be demonstrated in an isolated Dojo: https://dojo.telerik.com/ekIXopar by selecting the autocomplete input.

 

All Browsers Issue - Search Triggered by Modifier Keys

On all browsers, even non-IE11, pressing modifer keys (eg: ctrl, shift, caps-lock, etc...) will immediately trigger a search with whatever is in the textbox (including suggestions). This causes issues when combined with the suggest is true. The real-world use case for this was having our users go to paste in something:

1. The focus search and suggest fills in the textbox with the first search result
2. The user presses ctrl in preparation to ctrl-v paste.
3. Between ctrl and v, the autocomplete will trigger another search with the now suggested text as criteria, thus narrowing the result to only the 1, AND offsetting the selection by 1 at the start of the text (ie: all but the first letter is highlighted).
4. When the user finishes the paste, the result is the first letter of the original suggestion and whatever they pasted.

This can also be demonstrated in the above dojo. Simply select the input and press and release the ctrl button. You should immediately see the first character get unselected, and "Albania" should become the only auto-suggestion result.

Possible Causes

Digging into the Kendo AutoComplete source, the keydown listener is picking up the control key as it's own keydown. From here, we have some if/elses that perform certain logic such as moving the selection up/down. However, our example of ctrl (keycode 17), falls into the else logic, which triggers a search based on the input value.

Possible Solutions

1. If I put the focus listener before the autocomplete call, I remove the initial issue... however, the fundamental issue with modifier keys triggering searches remains. This is problematic as pressing control (and other modifier keys), imho, shouldn't directly change the user's search results.

2. Add additional listeners to filter our these keys before the kendo autocomplete init, and stop the events from getting to kendo (stopImmediatePropagation). May introduce some other issues...

Question

Is there a solution to the IE11 bug? And for modifier searches, is there better work-arounds, or is this something that Kendo could address in an update?

Martin
Telerik team
 answered on 09 Jan 2020
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
MultiColumnComboBox
Dialog
Chat
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
TextArea
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?