Jump to content

UniDBGridEditorDatePicker


SayeyeZohor

Recommended Posts

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

Link to comment
Share on other sites

7 hours ago, SayeyeZohor 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');
        }
    };
}

 

  • Like 1
Link to comment
Share on other sites

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 🙏 

  • Like 1
Link to comment
Share on other sites

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,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...