SayeyeZohor 6 Posted January 25 Share Posted January 25 In dbgrid, I display the solar calendar with a datetimepicker based on the tutorial at this link(1). But after selecting the date, the date is displayed in dbgrid as a Gregorian date. The codes of this link(2) are also not executed. What should I do to display the solar date in dbgrid cell? (1) : http://forums.unigui.com/index.php?/topic/1202-jalali-calendar/&do=findComment&comment=72928 (2) : http://forums.unigui.com/index.php?/topic/6709-jalali-farsi-db-date-picker-calendar/&do=findComment&comment=34122 TestUniDBGridEditorDatePicker.rar Quote Link to post Share on other sites
Sherzod 1148 Posted January 25 Share Posted January 25 11 minutes ago, SayeyeZohor said: TestUniDBGridEditorDatePicker.rar 52.86 kB · 0 downloads Hello, Please create a simple test case. I was unable to run your example. ShDateUtils, ShDateDB ? 1 Quote Link to post Share on other sites
SayeyeZohor 6 Posted January 25 Author Share Posted January 25 hi tnx for you bro ... TestUniDBGridEditorDatePicker(1).rar Quote Link to post Share on other sites
Sherzod 1148 Posted January 25 Share Posted January 25 7 hours ago, SayeyeZohor said: tnx for you bro ... TestUniDBGridEditorDatePicker(1).rar 39.18 kB · 1 download Hi, Thank you. Try this approach: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns[0].renderer = function(v) { if (v) { var jd = Ext.Date.convertToJalali(v); return jd.jalaliYear + '/' + Ext.String.leftPad(jd.jalaliMonth + 1, 2, '0') + '/' + Ext.String.leftPad(jd.jalaliDate, 2, '0'); } }; } 1 Quote Link to post Share on other sites
SayeyeZohor 6 Posted January 25 Author Share Posted January 25 1 hour ago, Sherzod said: Hi, Thank you. Try this approach: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns[0].renderer = function(v) { if (v) { var jd = Ext.Date.convertToJalali(v); return jd.jalaliYear + '/' + Ext.String.leftPad(jd.jalaliMonth + 1, 2, '0') + '/' + Ext.String.leftPad(jd.jalaliDate, 2, '0'); } }; } Tnx for you brother 🙏 1 Quote Link to post Share on other sites
A.Soltani 14 Posted January 31 Share Posted January 31 Hi How to put these codes for each column of date type?(Columns are create dynamically in runtime) Regards. Quote Link to post Share on other sites
Sherzod 1148 Posted January 31 Share Posted January 31 11 minutes ago, A.Soltani said: How to put these codes for each column of date type?(Columns are create dynamically in runtime) Hello, Something like using columns.forEach in function reconfigure. Quote Link to post Share on other sites
A.Soltani 14 Posted January 31 Share Posted January 31 Hi How to identify a date column console.log(col.xtype) logs 'gridcolumn' and not datecolumn. Regards. Quote Link to post Share on other sites
Sherzod 1148 Posted January 31 Share Posted January 31 1 hour ago, A.Soltani said: How to identify a date column console.log(col.xtype) logs 'gridcolumn' and not datecolumn. Hi, You can try this approach: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns.forEach(function(col) { if (col.ct && col.ct == 'datetime') { col.renderer = ... } }); } Regards, Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.