|
Title: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: 2plus2 on April 08, 2019, 07:43:14 PM Howdy...
I'm trying up update a client using EasyUI for JQuery and most of the grids work fine, except for a couple. I'm getting errors like the following: Code: Uncaught TypeError: Cannot read property 'options' of undefined I think I've traced this to the dataGrid, Code: $.fn.datagrid.methods = {But I can't find anything wrong with how the options are setup. I've moved them to the js reference (starts with toolbar): Code: $('#dg').datagrid({I've changed them from inline (original way) within the table to data-options parameter: Code: <table id="dg" title="Blah Blah Blah" style="height:300px" width="720px" or Code: <table id="dg" title="Blah Blah Blah" style="height:300px" width="720px" Nothing seems to work. All ideas welcome. P.S We had references to edatagrid (which I updated to latest version also) and a custom extension to EasyUI, I removed those just for this page and they don't appear to be the problem. Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: jarry on April 09, 2019, 02:19:52 AM Before loading data from server, please make sure if the '#dgFilter1' combobox component exists. If the combobox is not created, calling any methods will cause errors.
Code: onBeforeLoad: function (param) {Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: 2plus2 on April 09, 2019, 07:27:15 AM It's definitely before the datagrid in the JS flow (and it works fine with older versions of jQuery and jEasyUI). Is there an out of order issue using the latest version of jQuery v1.12.x?
Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: jarry on April 09, 2019, 08:37:36 AM What version are you using? Please show a live example to demonstrate your issue.
Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: 2plus2 on April 09, 2019, 07:37:04 PM I can't show working code because it's on an Intranet. If I can replicate via fiddle I'll let you know. We have attempted to upgrade to latest jEasy UI from 1.3.x.
I'll also try some order of execution steps, but we are also seeing issues with opening edit dialog boxes (new data entry dialog boxes work fine) and with input box icons being on left instead of right. Again, this is from a site that worked for 5 years, no changes before an update of jEasy and jQuery. Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: 2plus2 on April 10, 2019, 07:40:05 PM Ok - I found the primary error, the combo box box is firing the onSelect event when the combo box data is loaded (it contains a selected=true in the data). Since the data grid has not been built yet, that was causing the option error. This is different behavior from 1.3.4 combo box. (Very annoying.) I've routed around that using an existing variable that was helping the data grid load the data on the first page load.
Secondary error, when the combo box onSelect event is fired, it calls the datagrid load event. When the load event is called by the comb box the onBeforeLoad event is *not* firing. However the search box searcher event with the exact same call to the data grid load works perfectly. (So do the pagination events.) What's changed with the combo box that it's not communicating with the data grid correctly? Code:
Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: jarry on April 11, 2019, 07:29:30 AM If the datagrid hasn't been created, don't call any methods on it. You also can use the 'onChange' event instead. When a combobox is initialized, the 'onChange' event does not fire while the 'onSelect' event does.
Code: $('#dgFilter1').combobox({Title: Re: After upgrade: Uncaught TypeError: Cannot read property 'options' of undefined Post by: 2plus2 on April 11, 2019, 06:46:10 PM Thanks. I should have known that. Much appreciated.
That also fixed the communication with the data grid. Go figure. Have a great weekend. |