|
222 | 222 | import lodashorderby from 'lodash.orderby';
|
223 | 223 | import lodashincludes from 'lodash.includes';
|
224 | 224 | import lodashfindindex from 'lodash.findindex';
|
| 225 | + import ValueFieldSection from "./ValueFieldSection.vue"; |
225 | 226 |
|
226 | 227 |
|
227 |
| - /* Field Section used for displaying and editing value of cell */ |
228 |
| - var valueFieldSection = { |
229 |
| - template: '<span v-if="!enabled" @dblclick="toggleInput" class="editableField">{{this.entry[this.columnname]}}</span>'+ |
230 |
| - '<div v-else-if="enabled" class="input-group">'+ |
231 |
| - ' <input type="text" class="form-control" v-model="datavalue" @keyup.enter="saveThis" @keyup.esc="cancelThis">'+ |
232 |
| - ' <span class="input-group-btn">'+ |
233 |
| - ' <button class="btn btn-danger" type="button" @click="cancelThis" ><span class="fa fa-trash-alt" aria-hidden="true"></span></button>'+ |
234 |
| - ' <button class="btn btn-primary" type="button" @click="saveThis" ><span class="fa fa-check" aria-hidden="true"></span></button>'+ |
235 |
| - ' </span>'+ |
236 |
| - '</div>', |
237 |
| - props: ['entry','columnname'], |
238 |
| - data: function () { |
239 |
| - return { |
240 |
| - enabled: false, |
241 |
| - datavalue: "", |
242 |
| - } |
243 |
| - }, |
244 |
| - methods: { |
245 |
| - saveThis: function () { |
246 |
| - var originalValue = this.entry[this.columnname]; |
247 |
| - this.entry[this.columnname] = this.datavalue; |
248 |
| - this.$parent.$emit('cellDataModifiedEvent', originalValue, this.datavalue, this.columnname, this.entry); |
249 |
| - this.enabled = !this.enabled; |
250 |
| - }, |
251 |
| - cancelThis: function () { |
252 |
| - this.datavalue = this.entry[this.columnname]; |
253 |
| - this.enabled = !this.enabled; |
254 |
| - }, |
255 |
| - toggleInput: function () { |
256 |
| - this.datavalue= this.entry[this.columnname]; |
257 |
| - this.enabled=!this.enabled; |
258 |
| - }, |
259 |
| - } |
260 |
| - }; |
261 |
| -
|
262 | 228 | export default {
|
263 | 229 | name: "VueBootstrapTable",
|
264 | 230 | components: {
|
265 |
| - 'value-field-section': valueFieldSection, |
| 231 | + 'value-field-section': ValueFieldSection, |
266 | 232 | },
|
267 | 233 | props: {
|
268 | 234 | /**
|
|
0 commit comments