Sealyu

          --- 博客已遷移至: http://www.sealyu.com/blog

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks
          <2009年11月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆分類

          隨筆檔案

          友情鏈接

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          • Approach 1
            • Use the array grid example in your packaged download array-grid.js
            • Add an extra column to the column model definition and a custom renderer.
          {header: "Controls", 

          width: 60,

          sortable: false,

          renderer: function() {

          return '<div class="controlBtn">

          <img src="../shared/icons/fam/cog_edit.png"

          width="16" height="16"

          class="control_edit">

          <img src="../shared/icons/fam/folder_go.png"

          width="16" height="16"

          class="control_go"></div>';

          },

          dataIndex: 'company'}
            • Then you would setup an event handler on the click event.
          grid.on('click', function(e) {

          var btn = e.getTarget('.controlBtn');

          if (btn) {

          var t = e.getTarget();

          var v = this.getView();

          var rowIdx = v.findRowIndex(t);

          var record = this.getStore().getAt(rowIdx);

          var control = t.className.split('_')[1];

          switch (control) {

          case 'edit':

          console.log('edit this record - ' + record.id);

          break;

          case 'go':

          console.log('go to this record - ' + record.id);

          break;

          }

          }

          }, grid);
            • Add the following CSS rule in array-grid.html to give some padding and change the cursor.
          <style>

          .controlBtn img {

          padding-left: 4px;

          cursor: pointer;

          }

          </style>
            • Using this same method you could add as many tools as you would like in the controls section and always give them the css class "controls_{toolname}". Ideally you would break this out into an XTemplate so that you could simply pass in whatever tools you would like to use and output them on the grid as well.

          • Approach 2 utilizes a plugin as discussed here  :
          http://rowactions.extjs.eu/
          posted on 2009-11-30 14:57 seal 閱讀(318) 評論(0)  編輯  收藏 所屬分類: EXTJS
          主站蜘蛛池模板: 扎鲁特旗| 恩平市| 连山| 张掖市| 手游| 龙井市| 芦溪县| 广西| 临沧市| 法库县| 布拖县| 清原| 安阳市| 陆河县| 永州市| 墨竹工卡县| 岑溪市| 壤塘县| 横山县| 合作市| 连江县| 新安县| 雷山县| 利川市| 安阳市| 景德镇市| 肇州县| 长兴县| 清苑县| 金平| 彝良县| 九台市| 临泽县| 遂川县| 富宁县| 杭锦旗| 清镇市| 榆社县| 叙永县| 塔河县| 启东市|