Skip to content

Commit

Permalink
sample update
Browse files Browse the repository at this point in the history
  • Loading branch information
m2a2x committed Dec 3, 2020
1 parent 2675580 commit d5f394e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion public/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import './style.css';
import Vue from 'vue';
import Grid from '../src/vgrid';
import Grid, { VGridVueTemplate } from '../src/vgrid';

const NewComponent = Vue.extend({
props: ['rowIndex'],
render(h) {
return h('span', {
on: {
click: (e: MouseEvent) => {
e.stopPropagation();
console.log('click');
}
}
}, this.rowIndex);
},
});

function generateHeader(index: number) {
const asciiFirstLetter = 65;
Expand All @@ -15,6 +29,7 @@ function generateHeader(index: number) {
}
return label.toLowerCase();
}

function generateFakeDataObject(rowsNumber: number, colsNumber: number) {
const result: Record<any, any> = [];
const columns: Record<number, any> = {};
Expand All @@ -29,6 +44,9 @@ function generateFakeDataObject(rowsNumber: number, colsNumber: number) {
columns[col] = {
name: generateHeader(col),
prop: col,
};
if (col === 1) {
columns[col].cellTemplate = VGridVueTemplate(NewComponent);
}
}
result[row][col] = row + ':' + col;
Expand Down
2 changes: 1 addition & 1 deletion src/vue-template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const vueTemplateConstructor =
// if vue inited just update it's properties
for (const key in p) {
const propKey = key as keyof RevoGrid.ColumnDataSchemaModel;
el.$set(el, propKey, p[propKey]);
el.$props[propKey] = p[propKey];
}
return;
}
Expand Down

0 comments on commit d5f394e

Please sign in to comment.