jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Editor Change cells format Editor Change cells format #79348

    mamb121
    Participant

    Please Change javascript code in demo to

    
     var data = generatedata(500);
     var source = {
         localdata: data,
         datafields: [{
             name: 'firstname',
             type: 'string'
         }, {
             name: 'lastname',
             type: 'string'
         }, {
             name: 'productname',
             type: 'string'
         }, {
             name: 'date',
             type: 'date'
         }, {
             name: 'quantity',
             type: 'number'
         }, {
             name: 'price',
             type: 'number'
         }],
         datatype: "array"
     };
    
     var adapter = new $.jqx.dataAdapter(source);
     $("#jqxgrid").jqxGrid({
         width: 500,
         theme: 'energyblue',
         columnsheight: 30,
         source: adapter,
         sortable: true,
         showeverpresentrow: true,
         editable:true,
          columns: [{
             text: 'First Name',
             datafield: 'firstname',
             width: 90
         }, {
             text: 'Last Name',
             datafield: 'lastname',
             width: 90
         }, {
             text: 'Product',
             datafield: 'productname',
             width: 170
         },{
                          text: 'التاريخ', datafield: 'date', width: '15%', align: 'right', cellsalign: 'right', cellsformat: 'dd/MM/yyyy', columntype: 'datetimeinput', minwidth: '90px', rtl: true,
                                                createEverPresentRowWidget: function (datafield, htmlElement, popup, addCallback) {
                              var inputTag = $("<div style='border: none;'></div>").appendTo(htmlElement);
                              inputTag.jqxDateTimeInput({ value: null, popupZIndex: 99999999, placeHolder: "ادخل التاريخ: ", width: '100%', height: 30 });
                              $(document).on('keydown.date', function (event) {
                                  if (event.keyCode == 13) {
                                      if (event.target === inputTag[0]) {
                                          addCallback();
                                      }
                                      else if ($(event.target).ischildof(inputTag)) {
                                          addCallback();
                                      }
                                  }
                              });
                              return inputTag;
                          },
                          initEverPresentRowWidget: function (datafield, htmlElement) {
                          },
                          getEverPresentRowWidgetValue: function (datafield, htmlElement, validate) {
                              var value = htmlElement.val();
                              return value;
                          },
                          resetEverPresentRowWidgetValue: function (datafield, htmlElement) {
                              htmlElement.val(null);
                          }
                      }, {
             text: 'Quantity',
             datafield: 'quantity',
             width: 80,
             cellsalign: 'right'
         }, {
             text: 'Unit Price',
             datafield: 'price',
             cellsalign: 'right',
             cellsformat: 'c2'
         }]
     });
    

    for Example
    kindly .. follow this steps :
    1- add new row with date “01/02/2015”
    2- after added click on date cell To show Editor
    3- it Will show at “02/01/2015” why date is changed ??

Viewing 1 post (of 1 total)