0.1.4 • Published 4 years ago

element-tree-grid v0.1.4

Weekly downloads
58
License
MIT
Repository
github
Last release
4 years ago

element-tree-grid

tree grid extends element ui with vue

releases v1.0.4

  • try to expand row expanded after data reload

having problems with <el-table-column type="selection" fixed></el-table-column>

if you have any idea , welcome !!!

demos

start

  • clone to your project

    git clone https://github.com/foolishchow/element-tree-grid.git
    cd element-tree-grid
    npm install #or yarn
    npm run dev
  • use with node

    • install
      npm install element-tree-grid --save
    • in you project

      //common 
      var ElTreeGrid = require('element-tree-grid');
      Vue.component(ElTreeGrid.name,ElTreeGrid);

useage

  • common useage
    <el-table :data="model.menus" border max-height="250">
        <el-table-tree-column 
            file-icon="icon icon-file" 
            folder-icon="icon icon-folder" 
            prop="label" label="labelname" width="220"></el-table-tree-column>
        <el-table-column prop="description" label="description"   width="180"></el-table-column>
    </el-table>
  • get children from remote
    • html
      <div id="app" style="padding: 30px;">
          <el-table :data="model.menus" border max-height="400">
              <el-table-tree-column 
                  :remote="remote"
                  file-icon="icon icon-file" 
                  folder-icon="icon icon-folder" 
                  prop="label" label="MenuName" width="320"></el-table-tree-column>
              <el-table-column prop="id" label="id" width="180"></el-table-column>
              <el-table-column prop="description" label="Description" :show-overflow-tooltip="true" width="180"></el-table-column>
          </el-table>
      </div>
    • javascript
      new Vue({
          el: "#app",
          data: {
              model: {
                  menus: trees
              }
          },
          methods:{
              remote(row,callback){
                  // async or sync are both supported
                  setTimeout(function() {
                      callback(row.children)
                  },500)
              }
          }
      })
  • attributes

    all props of el-table-column are supported;

    namedescriptionvalues
    propsame as el-table-column
    labelsame as el-table-column
    widthsame as el-table-column
    fixedsame as el-table-column
    resizablesame as el-table-column
    formattersame as el-table-column
    classNamesame as el-table-column
    treeKeythe key for neasted parsetype:String, default:'id'
    childNumKeythe key of childNumtype:String, default:'child_num'
    parentKeythe key of parent_idtype:String, default:'parent_id'
    levelKeythe key of node's depthtype:String, default:'depth'
    childKeythe key of node's children been placedtype:String, default:'children'
    fileIconfile icon classNametype:String, default:'el-icon-file'
    folderIconfolder icon className ,when opend use: folderIcon-opentype:String, default:'el-icon-folder'
    remoteremote method to get childrentype:Function,default:null
    allRemoterequest all data from remote ,you have to config prop remote first,default use request cachetype:Boolean,default:false
    expandAllexpand all nodes when loadedtype:Boolean,default:false
    expandKeykey tells if the line is opened at inited ( just expended once )type:String,default:expanded
    indentSizeindent number ,united in pxtype:Number,default:14

examples

  • common
<el-table-tree-column 
            file-icon="icon icon-file" 
            folder-icon="icon icon-folder" 
            prop="label" 
            label="labelname" 
            width="220"></el-table-tree-column>
  • with formatter
<el-table-tree-column 
            file-icon="icon icon-file" 
            folder-icon="icon icon-folder" 
            prop="label" 
            label="labelname" 
            :formatter="formatter"
            width="220"></el-table-tree-column>
  • with scopedSolts
<el-table-tree-column 
            file-icon="icon icon-file" 
            folder-icon="icon icon-folder" 
            prop="label" 
            label="labelname" 
            width="220">
    <template slot-scope="scope">
        <span>prefix =></span>
        <span>{{scope.row.label}} -- {{scope.row.id}}</span> 
        <span><= suffix</span>   
    </template>
</el-table-tree-column>
0.1.4

4 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago