This is a migrated thread and some comments may be shown as answers.

When Kendo Grid Empty No Button Events

2 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 08 Apr 2021, 07:50 PM

Hi, 

I generate a grid definition upon a selection of information, and everything is working fine... until today
[note I am using cold fusion on the server side - which has caused no problems and that is what the CFSET tags are for below]

ignore the CFSET tags they exist for the code on the page and are not a problem

the cfinclude includes a grid definition which is generated on the fly to populate the grid. it basically defines that its pageable, the page sizes, button count, sizes the columns, and defines them. After the columns are defined there is a datasource: { data: [] }

this has the format of 

 datasource: { data: [

{fieldname:"value",fieldname:"value",fieldname:"value",fieldname:"value",fieldname:"value"}

{fieldname:"value",fieldname:"value",fieldname:"value",fieldname:"value",fieldname:"value"}

{fieldname:"value",fieldname:"value",fieldname:"value",fieldname:"value",fieldname:"value"}

] }

                        $("##ExactSearchGrid").kendoGrid({
                        toolbar: [
                                {name:"excel"},
                                {name:"Exact Selected Card", text:"View Selected Card", iconClass: "k-icon k-i-track-changes-enable"},
                                {name:"Create Card", text:"Create Card", iconClass: "k-icon k-i-change-manually"}, 
                                {name:"Exact Search Grid"}
                            ]
                            <cfset SearchQueryType = 'ExactSearchQuery'>
                            <cfset VSCType = 'EVSC'>
                            <cfset ExcelFilename = 'ExactSearch_' & Now() & '.xlsx'>
                            <cfinclude template="GridDefinition.cfm">
                            }

I discovered today that when this data array in dataSource is empty, events for buttons on the grid no longer trigger!!

IF I add a blank row of data at the end of the data array in dataSource, the grid thinks there is at least one record and the events are allowed

[however, the empty row has lines where a real empty grid would not]

 

this is a problem because we would like to have a button that only appears when there are no records that can then be used to kick off a process in our system

when the grid has data, i turn the buttons events off and on using CSS pointer-events: none; (by using addClass and removeClass)

.

.

.

.

Is there any way to turn on events which are negated when the grid is empty? or attach an event to the button that is on screen and can be pressed?

This actually took me a long time to figure out what was going on as i did not expect events to stop working when a grid was empty!!!!!

 

Thank you!  

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Ken
Top achievements
Rank 1
answered on 09 Apr 2021, 12:10 PM

FIXED... 

deep inside the definition of the grid was an extra comma...

this extra comma caused jquery to throw an error, which then stops the process which would later create the event

for some reason when there was data , this event creation happened anyway

when not, it threw a wrench into the whole thing and prevented events from occurring.. 

 

sorry for the bother... 

0
Anton Mironov
Telerik team
answered on 13 Apr 2021, 10:59 AM

Hi Ken,

Thank you for sharing the reason that caused the issue.

If assistance for anything else Kendo-related is needed, do not hesitate to contact me and the team.

 

Kind Regards,
Anton Mironov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
Grid
Asked by
Ken
Top achievements
Rank 1
Answers by
Ken
Top achievements
Rank 1
Anton Mironov
Telerik team
Share this question
or