2010-11-14 12 views
7

स्टोरExtJS 3.3 लौटने NaN

var timesheet = new Ext.data.JsonStore(
    { 
     root: 'timesheetEntries', 
     url: 'php/scripts/timecardEntry.script.php', 
     storeId: 'timesheet', 
     autoLoad: true, 
     fields: [ 
      { name: 'id', type: 'integer' }, 
      { name: 'user_id', type: 'integer' }, 
      { name: 'ticket_number', type: 'integer' }, 
      { name: 'description', type: 'string' }, 
      { name: 'start_time', type: 'string' }, 
      { name: 'stop_time', type: 'string' }, 
      { name: 'client_id', type: 'integer' }, 
      { name: 'is_billable', type: 'integer' } 
     ] 
    } 
); 

मेरी GridPanel कोड का एक वर्ग Format.Util.Ext.util.Format.dateRenderer :

{ 
    timesheetEntries:[ 
     { 
     "id":"1", 
     "user_id":"1", 
     "description":null, 
     "start_time":"2010-11-13 11:30:00", 
     "stop_time":"2010-11-13 15:50:10", 
     "client_id":null, 
     "is_billable":"0" 
     } 

मेरा ग्रिड पैनल ठीक प्रस्तुत करता है। हालांकि, मेरी शुरुआत और स्टॉप टाइम कॉलम 'NaN/NaN/NaN NaN: NaN: NaN' पढ़ते हैं और मुझे नहीं पता कि क्यों।

उत्तर

5

यदि आपके डेटा में "2010-11-13 11:30:00" है तो आपका प्रारूप 'Y-m-d H:i:s' नहीं होना चाहिए?

संपादित करें: क्षमा करें, ग्रिड config ठीक होना चाहिए - मैं अपनी दुकान के क्षेत्र परिभाषा dateFormat मूल्य है, जो 'Y-m-d H:i:s' इतना होना चाहिए कि आपके आने वाले डेटा को ठीक से अपने स्तंभ मॉडल के लिए मैप किया जा सकता का जिक्र किया गया था। आपको type: 'date' भी शामिल करना चाहिए। आप अपनी स्टोर कॉन्फ़िगरेशन नहीं दिखा रहे हैं, लेकिन समस्या यह है कि उन चीजों में से एक गलत है।

0

इस

समारोह renderDate प्रयास करें (V, परम, रिकॉर्ड) { वर डीटी = new Date (v);
अगर (! IsNaN (dt.getDay())) { वापसी dt.format ('d/m/y'); }
वापसी '-'; }