baig / jquerymobile-editablelistview

A jQuery Mobile Plugin with an intuitive UI to add new list items and remove existing ones.
http://wasifbaig.com/jquerymobile-editablelistview/
Other
36 stars 16 forks source link

Editable Listview within a JQM "page": Cannot read property '0' of undefined #14

Open plweil opened 8 years ago

plweil commented 8 years ago

I'm using the JQuery Mobile pages widget to display several form elements. one at a time. Each element uses a database query to display the current database value (if any) in the form upon load.

I have one element that utilizes Editable Listview. When the the database value is not empty, it displays just fine. But if the database value is empty, I get this error in the JS console:

Uncaught error: Cannot read property '0' of undefined

It points to line 161 in EditableListview:

// Re-enabling the click event handler when the list is in View mode evt.click[0].handler = this._clickHandler; evt.tap[0].handler = this._tapHandler;

Do you know what might be happening here, and how I might get around it?

Great plugin, by the way!

plweil commented 8 years ago

I'm testing a possible workaround that first tests to see whether evt.click is undefined. But I don't understand why it is undefined only when there is no data, and when I am displaying this element with the page widget.

baig commented 8 years ago

Sorry for such a late reply. I was way too occupied to look into this. I'll be looking into it this weekend.