Saltar navegación

[Resuelto] Sorting the Table columns and Sorting controls Error and Renaming

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: The sorting controls and table headers in my sortable table View do not seem to be working correctly. I see additional text appear next to the sorting controls, and some of the table headers do not function as sorting controls correctly.

Solution: Recreate the sorting control shortcodes in the legacy View editor and check the field slugs present in the table heading shortcodes to verify everything is in sync.

This support ticket is created hace 4 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Este tema contiene 6 respuestas, tiene 2 mensajes.

Última actualización por andrewD-10 hace 4 años, 3 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1798249

Hi toolset,

Please see my video to help explain what I noticed: enlace oculto

Thank you!
- Andrew

#1799533

Hi, I'll be glad to take a closer look. Can you tell me more about how you built this View - did you use the Block Editor, or the classic editor?

#1800715

Hi Christain,

Thank you for your help. I normally use the classic editor; however, this page is set up a bit differently. Please see the video to better show how the page is set up.

Video: enlace oculto

Thank you,
Andrew

#1800751

Thanks for the videos, would it be possible for you to copy + paste the codes from your Search and Pagination panel as well as the loop output editor here for me to review? I'm not able to replicate this exact issue in my local so I am curious to know what the difference is.

#1802121

Hi Christian, yes, please see below

Search & Pagination:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="filter-container">  
  <div class="backcolor">    
    <br>
	<div class="flex-container">
      
<div class="form-group">
	<label for="wpv-post-search">[wpml-string context="wpv-views"]<b>Keyword / Phrase Search:</b><br><span style="font-style:italic; font-size:14px;">(Searches project titles and summaries. Use " " for Phrases) </span>[/wpml-string]</label> [wpv-filter-search-box placeholder="Enter Keywords" output="bootstrap"] <center> [wpv-filter-spinner spinner="<em><u>enlace oculto</u></em>"][/wpv-filter-spinner] </center>
</div>
<div class="form-group">
	<label for="wpv-wpcf-agency-title">[wpml-string context="wpv-views"]<b>Agency Search:</b><br><span style="font-style:italic; font-size:14px;">(Searches agency name)</span>[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-agency-title" placeholder="Enter Agency Name" url_param="wpv-wpcf-agency-title"] <center> [wpv-filter-spinner spinner="<em><u>enlace oculto</u></em>"][/wpv-filter-spinner] </center>
</div>
<div class="form-group">
	<label for="wpv-wpcf-project-county">[wpml-string context="wpv-views"]<b>Project County:</b>[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-project-county" type="multi-select" url_param="wpv-wpcf-project-county"] <center> [wpv-filter-spinner spinner="<em><u>enlace oculto</u></em>"][/wpv-filter-spinner] </center>
</div>
</div> 
	<div class="flex-container">
<div class="form-group">
  <label for="wpv-wpcf-bid_date_min">[wpml-string context="wpv-views"]<b>Bid Date Min:</b>[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-bid_date" url_param="wpv-wpcf-bid_date_min"] <br>
  <label for="wpv-wpcf-bid_date_max">[wpml-string context="wpv-views"]<b>Bid Date Max:</b>[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-bid_date" url_param="wpv-wpcf-bid_date_max"] <center> [wpv-filter-spinner spinner="<em><u>enlace oculto</u></em>"][/wpv-filter-spinner] </center>
</div>
      <div class="form-group">
        <label for="wpv-wpcf-entry-date_min">[wpml-string context="wpv-views"]<b> Entry Date Min: </b>[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-entry-date" url_param="wpv-wpcf-entry-date_min"] <br>
	<label for="wpv-wpcf-entry-date_max">[wpml-string context="wpv-views"]<b> Entry Date Max: </b>[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-entry-date" url_param="wpv-wpcf-entry-date_max"] <center> [wpv-filter-spinner spinner="<em><u>enlace oculto</u></em>"][/wpv-filter-spinner] </center>
      </div>
      <div class="form-group">
        <b> Sort By: </b> <br> [wpv-sort-orderby type="radio" options="field-wpcf-bid_date,post_date" label_for_field-wpcf-bid_date="Bid Date" label_for_post_date="Entry Date" orderby_as_numeric_for="field-wpcf-bid_date" orderby_ascending_for="field-wpcf-bid_date" orderby_descending_for="post_date"][wpv-sort-order type="list" options="asc,desc" label_for_asc="Ascending" label_for_desc="Descending" label_asc_for_field-wpcf-bid_date="Ascending" label_desc_for_field-wpcf-bid_date="Descending" label_asc_for_post_date="Ascending" label_desc_for_post_date="Descending" list_style="grey"] <center> [wpv-filter-spinner spinner="<em><u>enlace oculto</u></em>"][/wpv-filter-spinner] </center>
      </div>
 </div>
  <div style="float:left;">[wpv-filter-reset reset_label="**Reset**" output="bootstrap" class="reset"]</div> <div style="float:right;">[wpv-filter-submit name="Search"] </div>
</div>
  <br>
  <br>
  <label>Results Below</label> <label style="font-style:italic">(table & map)</label>: [wpv-found-count]<br>
<p>Showing [wpv-items-count] per page</p>
  [wpv-pager-nav-links output="bootstrap" first_last_links="true" previous_next_links="true" reach="4"]
 </div>

[/wpv-filter-controls]
[wpv-filter-end]

Loop:

[wpv-layout-start]
	[wpv-items-found]
<div class="table-container">
	<!-- wpv-loop-start -->
	<table width="100%">
		<thead>
			<tr class="backcolor">
				<th style="width:9%">[wpv-heading name="entry-date"]Entry Date:[/wpv-heading]</th>
				<th>[wpv-heading name="post-link"]Project Title:[/wpv-heading]</th>
				<th style="width:9%">[wpv-heading name="types-field-bid_date"]*Bid Date:[/wpv-heading]</th>
				<th style="width:14%">[wpv-heading name="post-title"]Agency Name:[/wpv-heading]</th>
				<th style="width:9%">[wpv-heading name="types-field-pre-bid-meeting"]Pre-Bid Meeting:[/wpv-heading]</th>
				<th style="width:9%">[wpv-heading name="types-field-pre-bid-meeting-date"]Pre-Bid Meeting Date:[/wpv-heading]</th>
				<th style="width:11%">[wpv-heading name="types-field-engineers-estimate-max"]Eng Est (max):[/wpv-heading]</th>
				<th style="width:7%">[wpv-heading name=""]Docs:[/wpv-heading]</th>
				<th style="width:8%">[wpv-heading name="post-field"]Follow:[/wpv-heading]</th>
			</tr>
		</thead>
		<tbody class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<tr>
				[wpv-post-body view_template="loop-item-in-2020-01-09-new-current-project-table"]
			</tr>
		</wpv-loop>
		</tbody>
	</table>
  
   Total Results: [wpv-found-count]<br>
<p style="font-style: italic;">Showing [wpv-items-count] per page</p>
  [wpv-pager-nav-links output="bootstrap" first_last_links="true" previous_next_links="true" reach="4"]
  <br>
	<!-- wpv-loop-end -->
  </div>
	[/wpv-items-found]
  
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Below loop Editor

<td>[types field='entry-date' style='text' format='m/d/Y'][/types]</td>
<td><a class="visited-item" href="[wpv-post-url]" target="_blank" rel="noopener noreferrer">[wpv-post-title]</a></td>
<td>[types field='bid_date' style='text' format='m/d/Y'][/types]</td>
<td><a class="visited-item" href='[wpv-post-url item="@agency-post.parent"]' target="_blank" rel="noopener noreferrer">[wpv-post-title item="@agency-post.parent"]</a>
</td>
<td>[types field="pre-bid-meeting"][/types]</td>
<td>[types field="pre-bid-meeting-date"][/types]</td>
<td>[format-currency num="[types field='engineers-estimate-max'][/types]" sym="$"]</td>
<td>[types field='documents'][/types]</td>
<td>[wpw_follow_me]</td>
#1802209

Okay I can see that the sortable table headers and the sorting control shortcode are not in sync for some reason. Please take a look at this shortcode:

[wpv-sort-orderby type="radio" options="field-wpcf-bid_date,post_date" label_for_field-wpcf-bid_date="Bid Date" label_for_post_date="Entry Date" orderby_as_numeric_for="field-wpcf-bid_date" orderby_ascending_for="field-wpcf-bid_date" orderby_descending_for="post_date"][wpv-sort-order type="list" options="asc,desc" label_for_asc="Ascending" label_for_desc="Descending" label_asc_for_field-wpcf-bid_date="Ascending" label_desc_for_field-wpcf-bid_date="Descending" label_asc_for_post_date="Ascending" label_desc_for_post_date="Descending" list_style="grey"]

It seems that "Entry Date" and post_date have been confused or convoluted here somehow. In the options argument, the two sortable criteria seem to be the bid date custom field and the post_date, instead of the event date custom field. Then when you click the table headings to sort by Event Date, the system gets confused because the Event date custom field is not one of the option criteria. I suspect this is why the random radio button appears and extra text is added to the sorting control area. I suggest you start by recreating this sorting control shortcode in the View. You can just highlight the entire shortcode and delete it, then click "Sorting controls" to start creating a new control. If the new control shortcode does not resolve the problem, take a look at the Entry Date column header shortcode:

[wpv-heading name="entry-date"]Entry Date:[/wpv-heading]

If the field is created in Types, I would expect the name to include the types-field- prefix like the other heading names. So I suspect something was changed inadvertently here, maybe a copy + paste error or something like that is responsible for this issue, but it's hard to say. I would try the name types-field-entry-date instead, then try to recreate the wpv-sort-orderby shortcode once again.

Please try that and let me know the results, and we can go from there.

#1805015

Thank you Christian, you were absolutely correct. I went ahead and made sure the sorting control was for the "Entry Date" and made sure that my table header had the correct prefix.

Thank you!