Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

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

Open
minjuny opened this issue Jun 17, 2013 · 1 comment

Comments

@minjuny
Copy link

minjuny commented Jun 17, 2013

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
Copy link

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

  • Modified Ext.ux.TouchCalendarEvents.js, method getEventRecord:

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

Hope it helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants