Comments (3)
There is no plan to add create/edit functionality. However, this should be relatively easy to implement using templates. For example, to make the title
column editable, turn the title into an object:
{
value:'Some title',
editing:false
}
Then define the template:
title: function(h, row) {
if (!row.title.editing)
return <span on-click={this.edit.bind(this, row)}>{row.title.value}</span>;
return <div>
<input type='text' value={row.title.value}/>
<button on-click={this.save.bind(this,row)}>Save</button>
</div>;
}
Edit and save methods:
methods:{
edit: function(row) {
row.title.editing = true;
return row;
},
save: function(row) {
row.title.editing = false;
// send ajax request to update the value
return row;
}
}
from vue-tables-2.
Hello,
@matfish2 I have question related to your example. In vue file I have:
// ...
import show from './jsx/show.jsx'
// ...
columns: ['show']
// ...
templates: {
...
show: show
}
// ...
methods: {
show(row) {
console.log('CLICK');
},
}
show.jsx file:
export default function(h, row) {
return <span on-click={this.show.bind(this, row)}>show</span>
}
I have error: this.show is undefined
, when trying more attemps with on-click syntax I had errors:
TypeError: o.fn is not a function
.- Tried change
this
withthat
-that is undefined
. on-click={bus.$emit('id-selected', 1)} -
o.fn is not a function`
I use webpack from Laravel 2.1.0-beta.22, all node packages are fresh re-installed. Previous vue version was 2.0.x, current is up to date: 2.1.8.
.babelrc
{
"presets": ["es2015"],
"plugins": ["transform-vue-jsx"]
}
loaders in webpack config:
test: /\.jsx?$/,
loader: 'babel',
include: [
path.resolve(__dirname + '/node_modules/vue-tables-2/'),
path.resolve(__dirname + '/node_modules/vue-pagination-2/'),
path.resolve(__dirname + '/resources/assets/js/app/pages/projects/jsx/')
]
Currently I don't have idea what is bad in my code.
from vue-tables-2.
Found my problem. Methods must be declared in root component.
from vue-tables-2.
Related Issues (20)
- Changelog HOT 3
- Row double click HOT 2
- Variables inside custom header not updating HOT 4
- Documentation of disabledChildRows option HOT 1
- Change header of toggle column HOT 2
- editable edits all rows on click HOT 1
- how to manage table refresh HOT 1
- MouseUp event conflicts with other MouseUp events HOT 2
- problem with virtual pagination height HOT 6
- grouping doesn't show data HOT 4
- evaluate removal of background: white from thead tr th HOT 2
- customize column header titles HOT 1
- [question] sort by attribute, show another HOT 2
- Replacing cell content issues HOT 2
- Custom components in vue 3 HOT 2
- Set initial listColumns in dropdown HOT 2
- Add 'large-desktop' columnDisplay value(s)
- xscode down HOT 41
- Does uniqueKey support nested objects? HOT 2
- How to access table data from custom template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-tables-2.