/*  Mouse down the cell value and put it in the mouse-up cell */
/*
그리드에서 마우스다운한 셀 값 가져다(드레그 해서) 마우스업한 셀에 넣기 */



<html>
<head>
</head>
<link rel="stylesheet" type="text/css" charset="UTF-8" href="./theme-gray-all.css" />


<style type="text/css">
</style>


<script type="text/javascript" charset="UTF-8" src="./ext-all.js"></script>


<body>


<script language='javascript' >


var val_click;


Ext.onReady(function(){


  Ext.define('User', {
      extend: 'Ext.data.Model',
      fields: [ 'name', 'email', 'phone' ]
  });


  var userStore = Ext.create('Ext.data.Store', {
      model: 'User',
      data: [
         { name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1221' },
         { name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1232' },
         { name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1243' },
         { name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' }
      ]
  });


  Ext.create('Ext.grid.Panel', {
      renderTo: document.body,
      store: userStore,
      width: 400,
      height: 200,
      title: 'Application Users',
      editable : true, 
      columns: [
          {
              text: 'Name',
              width: 100,
              sortable: false,
              hideable: false,
              dataIndex: 'name'
          },
          {
              text: 'Email Address',
              width: 150,
              dataIndex: 'email',
              hidden: true
          },
          {
              text: 'Phone Number',
              flex: 1,
              dataIndex: 'phone' ,          
              editable: true
          }
      ] ,
      listeners: {
   'cellmousedown': function(iView, iCellEl, iColIdx, iStore, 
                                         iRowEl, iRowIdx, iEvent) {
           var rec = this.getStore().getAt(iRowIdx);
           var val2 = this.columns[iColIdx].dataIndex;
           val_click =  rec.get(  val2  );
           console.log(' value :: ' + val_click );
   },
   'cellmouseup': function(iView, iCellEl, iColIdx, iStore, 
                                      iRowEl, iRowIdx, iEvent) {
           var rec = this.getStore().getAt(iRowIdx);
           var val2 = this.columns[iColIdx].dataIndex;        
            rec.set(  val2  , val_click   );
   }
      }      
  }); 
});




</script>
<title>Simple Grid Sample for ExtJs</title>
</body>
</html>




 

 

Posted by 혜화초보
,




 




<html>

<head>

</head>

<script  language="javascript"  >

 

// 2016 , 2  값을 변수 처리 하면 됩니다.

// 2016년 2월의 마지막 일자를 리턴.

 function exe(){

     var lastDay = new Date( 2016 , 2 , 0);

     console.log(' lastDay: '+ lastDay );

 }


</script>

    <body  >

        <div  style="  height:200px ; padding-top:200px ; padding-left:200px "  >

          <a href="javascript:exe();"  >  click  </a>        

        </div>

    </body>

</html>







'[.js] 날짜' 카테고리의 다른 글

날짜 빼기 , 11개월전 날짜 구하기  (0) 2018.11.21
현재날짜 YYYYMMDDHHMMSS  (0) 2018.10.05
날짜 초 분 더하기 빼기  (0) 2017.09.08
현재 날짜 구하기  (0) 2017.09.06
Posted by 혜화초보
,

<html>

<head>


<style type="text/css">

 <!--

  #base1 {

  background-color: #F3F2F6;

  width: 10px;

  height: 10px;

  position:absolute;

  }

 

 //-->

 </style>


</head>


<script  language="javascript"  >

 

 /*  x1 , y1  (점A)   x2 , y2(점B)  두 점사이의 거리를 구하라~

 */

 

 var ppp = 0;

 

 

 function cal_exe(){

 

    var x1 = 10.3;

    var y1 = 10.3;    

    

    var x2 = 20.2;

    var y2 = 20.2;    

    

    var dis_x = x1 - x2;

    var dix_y = y1 - y2;


    result1 = Math.sqrt(Math.abs(dis_x*dis_x) + Math.abs(dix_y*dix_y));

    

    console.log( result1 );

    

 }

  


</script>

    <body    >

        <div id='base1' ></div>

   

        <div id="container">

        </div>

        

        <a href="javascript:cal_exe();"  >bbbbb</a>

    </body>


</html>



Posted by 혜화초보
,