@@ -44,6 +44,13 @@ function show_column_selection_dialog(context) {
4444 ? "value"
4545 : null ,
4646 } ,
47+ {
48+ fieldname : "description_column" ,
49+ label : __ ( "as Description" ) ,
50+ fieldtype : "Select" ,
51+ options : [ null ] . concat ( context . columns ) ,
52+ default : context . columns . includes ( "description" ) ? "description" : null ,
53+ } ,
4754 {
4855 fieldname : "filters_column" ,
4956 label : __ ( "Filter" ) ,
@@ -92,6 +99,7 @@ function show_column_selection_dialog(context) {
9299 file_path : context . file_path ,
93100 code_column : values . code_column ,
94101 title_column : values . title_column ,
102+ description_column : values . description_column ,
95103 filters : filters ,
96104 } ,
97105 callback : function ( r ) {
@@ -119,10 +127,12 @@ function show_column_selection_dialog(context) {
119127function update_preview ( dialog , context ) {
120128 let code_column = dialog . get_value ( "code_column" ) ;
121129 let title_column = dialog . get_value ( "title_column" ) ;
130+ let description_column = dialog . get_value ( "description_column" ) ;
122131
123132 let html = '<table class="table table-bordered"><thead><tr>' ;
124133 if ( title_column ) html += `<th>${ __ ( "Title" ) } </th>` ;
125134 if ( code_column ) html += `<th>${ __ ( "Code" ) } </th>` ;
135+ if ( description_column ) html += `<th>${ __ ( "Description" ) } </th>` ;
126136
127137 // Add headers for filterable columns
128138 for ( let column in context . filterable_columns ) {
@@ -143,6 +153,10 @@ function update_preview(dialog, context) {
143153 let code = context . example_values [ code_column ] [ i ] || "" ;
144154 html += `<td title="${ code } ">${ truncate ( code ) } </td>` ;
145155 }
156+ if ( description_column ) {
157+ let description = context . example_values [ description_column ] [ i ] || "" ;
158+ html += `<td title="${ description } ">${ truncate ( description ) } </td>` ;
159+ }
146160
147161 // Add values for filterable columns
148162 for ( let column in context . filterable_columns ) {
0 commit comments