Telerik Forums
Kendo UI for jQuery Forum
0 answers
130 views

I have the exact same HTML as the example of a kendo grid but the payloads are completely different mine is:

HTML:

while the payload from the example is:

Example HTML

 

John
Top achievements
Rank 1
 updated question on 16 Nov 2022
2 answers
5.8K+ views

I have a grid I've created in MVC that is throwing the following error when I set the datasource

kendo.all.js:311085 Uncaught TypeError: Cannot read properties of undefined (reading 'id')

Using version 2022.2.802.545

Here is my grid

@(Html.Kendo().Grid<MyModelName>()
            .Name("event-violations-grid")
            .Columns(columns =>
            {
                //columns.Select().Width(50);
                columns.Bound(s => s.SupplierNumber).Hidden(true);
                columns.Bound(s => s.SupplierName).Width(275);
                columns.Bound(s => s.OldOrderDate).Format("{0:MM/dd/yyyy}").Hidden(true);
                columns.Bound(s => s.OldDeliveryDate).Format("{0:MM/dd/yyyy}").Hidden(true);
                columns.Bound(s => s.NewOrderDate).Format("{0:MM/dd/yyyy}").Hidden(true);
                columns.Bound(s => s.NewDeliveryDate).Format("{0:MM/dd/yyyy}").Hidden(true);
                columns.Bound(s => s.ArrivalDate).Format("{0:MM/dd/yyyy}").Hidden(true);
                columns.Bound(s => s.TransmitTime).Hidden(true);
                columns.Bound(s => s.ExpectedDeliveryTime).Hidden(true);
                columns.Bound(s => s.Action).Width(180);
                columns.Bound(s => s.ActionComments);
            })
            .Sortable()
            .Scrollable(s => s.Height("215px"))
            .HtmlAttributes(new { style = "height:250px;" })
            .Resizable(r => r.Columns(true))
        )

(I know there is a lot of hidden columns there.. I may or may not need them yet)

Then I have some javascript which populates a dataSource and sets to this grid

function getViolations() {
    var vdata = {};
    vdata["stageId"] = _stageId;
    vdata["stores"] = "" + _stores.join(',');
    vdata["supplierNumber"] = _eventRevertData.SupplierNumber;
    vdata["origDeliveryDate"] = kendoDateOnly(_eventRevertData.Start);
    vdata["newDeliveryDate"] = null;

    var dataSource = new kendo.data.DataSource({
        schema: {
            model: {
                fields: {
                    SupplierNumber: { type: "number" },
                    SupplierName: { type: "string" },
                    OldOrderDate: { type: "date" },
                    OldDeliveryDate: { type: "date" },
                    NewOrderDate: { type: "date" },
                    NewDeliveryDate: { type: "date" },
                    ArrivalDate: { type: "date" },
                    TransmitTime: { type: "string" },
                    ExpectedDeliveryTime: { type: "string" },
                    OrderGroup1: { type: "boolean" },
                    OrderGroup2: { type: "boolean" },
                    OrderGroup3: { type: "boolean" },
                    OrderGroup4: { type: "boolean" },
                    OrderGroup5: { type: "boolean" },
                    OrderGroup6: { type: "boolean" },
                    OrderGroup7: { type: "boolean" },
                    OrderGroup8: { type: "boolean" },
                    Action: { type: "string" },
                    ActionComments: { type: "string" }
                }
            }
        },
        transport: {
            read: {
                url: "/MyController/GetViolationsGrid1",
                data: vdata,
                dataType: "json"
            }
        }
    });
    dataSource.fetch(function () {
        let data = this.data();
        console.log(data);
        var grid = $("#event-violations-grid").data("kendoGrid");
        grid.setDataSource(data);
    });
}

This works - my grid displays exactly as I expect, and updates when I call my function (the vdata changes depending on other things)

However, I'm getting this error:

If I open that, I can see that the part of "my" code is here:

Which brings me to here

I have confirmed that I can get as far as line 1228 without issue.. my console.log works and I can see my data.. it seems like it is happening when I'm setting the data source

Any help would be greatly appreciated!

Thanks

 

Thomas
Top achievements
Rank 1
Iron
 updated answer on 16 Nov 2022
6 answers
1.0K+ views
I am trying to build a single page application with Kendo UI. I have 7 drop down lists and 2 combo boxes on a form. 2 out of 7 drop downs will have same values. 
What is the best way to get data and bind to these controls?

1. Make everything an individual datasource
2. One data source which will have all the collections and bind them once the read request is completed
3. Any other approach?

Neli
Telerik team
 updated answer on 16 Nov 2022
4 answers
221 views

Hi, 

I've got a very simple Toolbar. It has one buttonGroup with three buttons that all belong to the same group. When the Toolbar initially loads, none of the buttons in the group are selected (toggled on). The user clicks one and all is good.

But, then I have another process on my page that requires me to reset the buttonGroup back to it's original state.  That is, none of the buttons in the Group are selected (toggled on).

Is this possible? 

The only solution I have seen codes like this, but this only removes the class. The "state" of the buttons is unchanged.
$('#ActionsButtons>a.k-selected').removeClass('k-selected');

Thanks for any help,
John

 

John
Top achievements
Rank 2
Iron
 answered on 15 Nov 2022
0 answers
104 views

I dont know if is a known issue but I didnt find another question about this, please let me know if it is a duplicate.

 

So, the scheduler has a refresh button, when you click it the datasource.read is triggered to load the data.

But for some reason, if you select an event and then click on refresh button, the start date will be changed to the date of the selected event and the old events will disappear due to date filter.

 

I wrote a dojo to show the issue: https://dojo.telerik.com/omIxeDUx/8

 

Reproduce steps:

- Open the dojo

- Select an event of any date greater than the first date (fixed 2022-10-10)

- Click the refresh button

- You will see that the start date changed and some events will not be shown.

 

 

EDIT

For those who have the same problem, I'm make a workaround (I dont know if will work for any context), I just remove the refresh button of the scheduler and then add a new button which onclick event will just call the datasource.read() function.

The following dojo has this work around: https://dojo.telerik.com/omIxeDUx/9

 

Hilton Pereira
Top achievements
Rank 1
 updated question on 14 Nov 2022
1 answer
746 views

We have a .Net Core 6 application.

We are using the "jQuery Grid Detail Template" to display a customer's orders in a KendoGrid. Then when the detail template icon is clicked, we fetch the order details and show those rows in another sub kendoGrid.

We are following this example: https://demos.telerik.com/kendo-ui/grid/detailtemplate

We can get this working for our situation, but only for the first customer that is searched.

When a different customer orders are searched, and the detail icon is clicked, we get an error ("Uncaught TypeError: Cannot convert undefined or null to object").

Our UI uses the "kendo-dropdownlist" for customer names, and a "Html.Kendo().DatePicker()" for the From/To date ranges. And a "Html.Kendo().DropDownButton()" for a Search button.

This is what happens when the form is first loaded:
1: user selects customer + date range then clicks [Search]
2: the javascript function "GetMyData()" is called
3: The "$("#myOrders-grid").kendoGrid" is populated correctly
4: when any details icon is clicked, the "detailInit: detailInit" function is called, the detail data is fetched and displayed correctly in sub grid.

PROBLEM occurs here
5: user selects a different customer and clicks [Search]
6: The "$("#myOrders-grid").kendoGrid" is populated correctly
7: BUT when any details icon is clicked, this error is generated: "Uncaught TypeError: Cannot convert undefined or null to object"
    the "detailInit: detailInit" function is never triggered
8: HOWEVER: If I select the original customer and original date range from dropdown and press [Search], the details icon works again, but only for the original customer and date range.

It seems like something remembers only the original customer's data. Do I have to clear something from memory?

What am I doing wrong below?

 


//My pseudo code 
function GetMyData(e) {
	var formattedStartDate = dateFns.parse(datefrom.value, 'YYYY-MM-DD hh:mm:ss')
	var formattedEndDate = dateFns.parse(dateto.value, 'YYYY-MM-DD hh:mm:ss')
	var myUrlString = '@Url.Action("GetOrders", "MyController")'
	var payloadContent = {
		"customerId": parseInt(customerDropdown.value),
		"startDate":  formattedStartDate,
		"endDate": formattedEndDate
		}
	$("#myOrders-grid").kendoGrid({
		dataSource: {
			transport: {
				read: function(options) {
					axios.post(myUrlString, payloadContent).then(function (response) {
						options.success(response.data);
					})
				}
			},
			pageSize: 10,
			sort: { field: "eventStart", dir: "asc" },
			schema: {
				model: {
					fields: {
						eventStart: { type: "date" },
						...ETC
					}
				}
			}
		},
		detailTemplate: kendo.template($("#template-details").html()),
		detailInit: detailInit,
		height: 600,
		sortable: true,
		pageable: {
			numeric: true
		},
		columns: [
			{ field: "eventStart", title: "Event Start", format: "{0:MM/dd/yyyy}", width: "6%" },
			...ETC
		],
		excel: {
			fileName: "orders-data.xlsx",
			allPages: true,
			filterable: true
		},
	})
}

function detailInit(e) {
	var detailRow = e.detailRow;
	var detailsUrlString = '@Url.Action("GetDetails", "MyController")'
	var payloadContent = {
		"customerID": e.data.custId,
		"orderID":  e.data.orderid
		}

	detailRow.find(".detailTabstrip").kendoTabStrip({
		animation: {
			open: { effects: "fadeIn" }
		}
	});

	detailRow.find(".details").kendoGrid({
		dataSource: {
			transport: {
					read: function(options) {
						axios.post(detailsUrlString, payloadContent).then(function (response) {
							options.success(response.data);
						})
					}
				},

			pageSize: 10,
			sort: { field: "orderID", dir: "asc" },
			schema: {
				model: {
					fields: {
						description: { type: "string" },
						...ETC
					}
				}
			},
		},
		scrollable: false,
		sortable: true,
		height: 250,
		pageable: true,
		columns: [
			{ field: "description", title:"Description" },
			...ETC
		]
	});
}

 


<script type="text/javascript" id="template-details">
        <div class="detailTabstrip">
            <ul>
                <li class="k-active">
                    Order Details
                </li>
                <li>
                    Customer Details
                </li>
            </ul>
            <div>
                <div class="details"></div>
            </div>
            <div>
                <div class='customer-details'>
                    <h3>Customer details will go here later</h3>
                </div>
            </div>
        </div>
</script>

Jerry
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 14 Nov 2022
2 answers
234 views

We are using the kendoGrid detailTemplate to display a sub grid of data. This is working well.

However, the first column in the grid that contains the right pointer icon has a wide width. the online examples show a narrow width.

How can we control the width of the first column that contains the right pointer icon?


$("#mygrid-grid").kendoGrid({
.....
detailTemplate: kendo.template($("#template-details").html()),
detailInit: detailInit,
....
columns: [
{ field: "eventStart", title: "Event Start", format: "{0:MM/dd/yyyy}", width: "6%" },
......

 

 

 


Jerry
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 14 Nov 2022
0 answers
84 views

See the attached screenshot and dojo link.  How do I show the values as percentages of the total?  For some reason, the chart is starting with 97% rather than 0%.

http://dojo.telerik.com/@kevin@nmthome.com/EbetIVUl

Kevin
Top achievements
Rank 1
 asked on 14 Nov 2022
1 answer
123 views

I want button add title tag.  "data refresh".

 

How can I make it simple?

 

                    $("#toolbar").kendoToolBar({
                        items: [
                            { id: "btn_reload", icon: "k-icon k-i-reload", type: "button", overflow: "never" },

 

Thank you.

 

Lyuboslav
Telerik team
 answered on 14 Nov 2022
1 answer
102 views

Hi, I want to show the time slot time under the cursor as you move about the scheduler. Similar to attached gif:

 

The problem is that when I navigate to a different day I can't re-bind the mouse move event. My code looks as follows, any help would be greatly appreciated.

Navigate:

EnableTimeTracking:

Thanks...

 

Neli
Telerik team
 answered on 11 Nov 2022
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
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
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
AICodingAssistant
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?