@@ -132,8 +132,10 @@ In your template
132132| summary | Optional | String | Summary: 'sum', 'avg', 'max', 'min'. Default is null |
133133| sort | Optional | Function | The custom function for sorting the column |
134134| link | Optional | Function | The function to react to the alt-click on cell text |
135+ | is-link | Optional | Function | The function to identify it is a link |
135136| to-text | Optional | Function | The function to convert from object value to edit-text |
136137| to-value | Optional | Function | The function to convert from edit-text to object value |
138+ | placeholder | Optional | String | The custom text if the field is null |
137139
138140@ - Function can return a promise
139141
@@ -153,6 +155,7 @@ In your template
153155| datetick | unix timestamp | yyyy-mm-dd | left | valid date | none | Y |
154156| datetimetick | unix timestamp | yyyy-mm-dd hh: mn | left | valid datetime | none | Y |
155157| datetimesectick | unix timestamp | yyyy-mm-dd hh:mn: ss | left | valid datetimesec | none | Y |
158+ | action | string | null | center | none | none | Y |
156159
157160## Hot Key List
158161
@@ -230,18 +233,20 @@ In your template
230233
231234### Variable Component: vue-excel-editor
232235
233- | Name | Type | Description |
234- | :--- | :--- | :--- |
235- | processing | Boolean | Component is busy or not |
236- | pageTop | Number | The top row number of the current page |
237- | pageSize | Number | The number of rows of each page |
238- | fields | AOO | It contains the column spec create when mount |
239- | filterColumn | Object | Contains the current filters, developer can access the filter string via this |
240- | table | AOO | It contains the filtered records |
241- | selected | Object | Contains all the selected rows, the key is row number and the value is internal $id |
242- | selectedCount | Number | Number of rows are selected |
243- | errmsg | Object | Contains all the validation error messages, the key is internal $id plus field name |
244- | redo | AOA | The buffer of undo, it will be removed after undo or table changed |
236+ | Name | Type | Description |
237+ | :--- | :--- | :--- |
238+ | processing | Boolean | Component is busy or not |
239+ | pageTop | Number | The top row number of the current page |
240+ | pageSize | Number | The number of rows of each page |
241+ | fields | AOO | It contains the column spec create when mount |
242+ | filterColumn | Object | Contains the current filters, developer can access the filter string via this |
243+ | table | AOO | It contains the filtered records |
244+ | selected | Object | Contains all the selected rows, the key is row number and the value is internal $id |
245+ | selectedCount@ | Number | Number of rows are selected |
246+ | errmsg | Object | Contains all the validation error messages, the key is internal $id plus field name |
247+ | redo | AOA | The buffer of undo, it will be removed after undo or table changed |
248+
249+ @ - allow v-model binding
245250
246251AOA = Array of Array, i.e. [[ ...] , [ ...]]
247252AOO = Array of Object, i.e. [ {...}, {...}]
@@ -451,22 +456,31 @@ methods: {
451456You may also want to watch the selected records count for displaying the action buttons. For example:
452457
453458``` html
459+ <vue-excel-editor v-model:selected-count =" count" >
460+ ...
461+ </vue-excel-editor >
462+
454463<button v-show =" showDeleteAction" > Delete </button >
455464<button v-show =" showSendEmailInvitationAction" > Invite </button >
456465<button v-show =" showSendBirthdayGreetingAction" > Greeting </button >
457466```
458467
459468``` js
469+ data () {
470+ return {
471+ count: 0
472+ }
473+ }
460474computed: {
461475 showDeleteAction () {
462- return this .$refs . grid . selectedCount > 0 // Show if any records selected
476+ return this .count > 0 // Show if any records selected
463477 },
464478 showSendEmailInvitationAction () {
465- return this .$refs . grid . selectedCount === 1 // Show if single record is selected
479+ return this .count === 1 // Show if single record is selected
466480 },
467481 showSendBirthdayGreetingAction () {
468482 // Show only if any selected people birthday matched today
469- if (this .$refs . grid . selectedCount > 0 ) {
483+ if (this .count > 0 ) {
470484 return this .$refs .grid .getSelectedRecords ().filter (item => item .birth === today).length > 0
471485 else
472486 return false
@@ -732,18 +746,23 @@ Use this with care. The summary calculation eats resource, so it only calculates
732746This is a nice feature in enterprise applications. Actually, I was learning from SAP UI. When the user holds the function key (Alt-key here) and move the mouse over the cell content, the text will show as a link. If user clicks on the link, your custom function will be triggered. The following example shows how to route to the user profile page by clicking on the name column cell.
733747
734748` ` ` html
735- < vue- excel- column field= " name" label= " Name" type= " string" width= " 150px" : link= " routeToUserFunc" / >
749+ < vue- excel- column field= " name" label= " Name" type= " string" width= " 150px" : link= " routeToUserFunc" : is - link = " showLinkOrString " / >
736750` ` `
737751
738752` ` ` js
739753methods: {
740754 // Hold Alt Key and click on any name, program will route to the page "User Profile"
741755 routeToUserFunc (content , record ) {
742756 this .$router .push (` /user/${ record .user } ` )
757+ },
758+ showLinkOrString (record ) {
759+ return record .gender === ' M' // Only gender M show the link
743760 }
744761}
745762` ` `
746763
764+ All links will be set as readonly
765+
747766### Text/Value conversion
748767
749768Sometimes displaying text and the store value will be different. In order to deal with this, you could use column properties to-text and to-value.
@@ -765,6 +784,54 @@ methods: {
765784}
766785` ` `
767786
787+ ### Badge
788+
789+ Sometimes we want to display the text in badge style.
790+
791+ ` ` ` html
792+ < vue- excel- column field= " user" label= " User ID" type= " badge" width= " 80px" : bg- color= " badgeColor" / >
793+ ` ` `
794+
795+ ` ` ` js
796+ methods: {
797+ badgeColor (rec ) {
798+ return ' blue'
799+ }
800+ }
801+ ` ` `
802+
803+ All badge will be set as readonly
804+
805+ ### Action
806+
807+ Sometimes we want to display the list of actions for record processing, such as Edit/Remove.
808+
809+ ` ` ` html
810+ < vue- excel- column field= " do" label= " Action" type= " action" : options= " ['Edit', 'Remove']" width= " 100px" : change= " doAction" placeholder= " Action" / >
811+ ` ` `
812+
813+ ` ` ` js
814+ methods: {
815+ doAction (rec ) {
816+ if (rec .do === ' Edit' )
817+ // do Edit process
818+ else if (rec .do === ' Remove' )
819+ // do Remove process
820+ }
821+ }
822+ ` ` `
823+
824+ All action will be set as non-readonly
825+
826+ ### Password
827+
828+ For password editing:
829+
830+ ` ` ` html
831+ < vue- excel- column type= " password" field= " pwd" label= " Password" width= " 90px" / >
832+ ` ` `
833+
834+
768835### Localization
769836
770837The developer may override the default values through localized-label prop.
0 commit comments