SwarmOnline / Ext.ux.TouchCalendar

Sencha Touch Calendar component
113 stars 47 forks source link

Error with finding record while eventtap, if setting idProperty on the Model definition. #22

Open minjuny opened 11 years ago

minjuny commented 11 years ago

I tried to modify model definition for working on my server api, and then setting the idProperty for unique event id as like below Ext.define('MomPapa.model.Program', { extend: 'Ext.data.Model', config: { idProperty: 'progress_idx', fields: [{ name: 'progress_idx', type: 'int' }, { name: 'event', type: 'string' }, { name: 'title', type: 'string' }, { name: 'start', type: 'date', dateFormat: 'c' }, { name: 'end', type: 'date', dateFormat: 'c' }, { name: 'css', type: 'string' }] } });

and then... the eventtap handler get the undefined eventRecord, because searching record failed... I eventually found the code that make error. in the below code, you try to find the record by comparing internalId and eventID with === operator. However, in this case, internalId is string and eventId is number, so always this searching cannot find anything... /* * Get the Event record with the specified eventID (eventID equates to a record's internalId) * @method * @private * @param {Object} eventID / getEventRecord: function(eventID){ var eventRecordIndex = this.calendar.eventStore.findBy(function(rec){ return rec.internalId === eventID; }, this); return this.calendar.eventStore.getAt(eventRecordIndex); },

Please check this issue..

ahernandezgil commented 10 years ago

Hi, have the same problem... what I did:

return rec.internalId == eventID; // Use == instead of ===

Hope it helps.