Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tablesoter is not working when first row has empty value #1821

Open
kotarao opened this issue Jul 12, 2022 · 2 comments
Open

tablesoter is not working when first row has empty value #1821

kotarao opened this issue Jul 12, 2022 · 2 comments

Comments

@kotarao
Copy link

kotarao commented Jul 12, 2022

Hi,

need help on tablesorter.

TableSorter is not working when date field first row is empty. when I enter some date on first field , sorting is working fine.

Please can you help me what I need to change here?

$(document).ready(
$(function () {
$('#GridViewSummaryResults').tablesorter({
widgets: ['zebra'], theme: 'blue', headers: { 0: { sorter: false } }, emptyTo: 'top',
textExtraction: {
1: function (node, table, cellIndex) { return $(node).find("span").text(); },
2: function (node, table, cellIndex) { return $(node).find("span").text(); },
3: function (node, table, cellIndex) { return $(node).text(); },
4: function (node, table, cellIndex) { return $(node).text(); }
}

			});

		})
	);

My HTML code is

<thead>
	<tr>			
		<th>
			Order #
		</th>
		<th>
			Customer
		</th>
		<th>

			PO
		</th>
		<th>
			Date
		</th>
		<th>
			Total
		</th>
	</tr>
</thead>

<tbody>
	
		<tr>				
			<td  >
				<a href="javascript:alert('Order # SO71774')">SO71774</a>
			</td>
			<td>
				 <span id="GridViewSummaryResults_name1">Good Toys</span>					
			</td>
			<td>
				 <span id="GridViewSummaryResults_PO1">PO348186287</span>					
			</td>
			<td>
			
			</td>
			<td>
				$972.78
			</td>

		</tr>
					
	
		<tr class="even">				
			<td  >
				<a href="javascript:alert('Order # SO71775')">SO71775</a>
			</td>
			<td>
				 <span id="GridViewSummaryResults_name2">Cycle Clearance</span>					
			</td>
			<td>
				 <span id="GridViewSummaryResults_PO2">PO58159451</span>						
			</td>
			<td>
				01/06/10
			</td>
			<td>
				$2,313.13
			</td>

		</tr>
		
		
	
		<tr>				
			<td  >
				<a href="javascript:alert('Order # SO71776')">SO71776</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name3">West Side Mart</span>						
			</td>
			<td>
				<span id="GridViewSummaryResults_PO3">PO19952192051</span>	
				
			</td>
			<td>
				10/01/15
			</td>
			<td>
				$87.09
			</td>
		</tr>
		<tr class="even">				
			<td  >
				<a href="javascript:alert('Order # SO71777')">SO71777</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name4">Demand Distributors</span>
				
			</td>
			<td>
				<span id="GridViewSummaryResults_PO4">PO20097113391</span>						
			</td>
			<td>
				07/01/17
			</td>
			<td>
				$1,267.82
			</td>

		</tr>
		
	<tr>				
			<td  >
				<a href="javascript:alert('Order # SO71776')">SO71786</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name5">West Side Mart5</span>						
			</td>
			<td>
				<span id="GridViewSummaryResults_PO5">PO19952192041</span>	
				
			</td>
			<td>
				&nbsp;
			</td>
			<td>
				$87.09
			</td>
		</tr>
		<tr class="even">				
			<td  >
				<a href="javascript:alert('Order # SO71777')">SO71778</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name6">Demand Distributors6</span>
				
			</td>
			<td>
				<span id="GridViewSummaryResults_PO6">PO20097113396</span>						
			</td>
			<td>
				&nbsp;
			</td>
			<td>
				$1,267.82
			</td>

		</tr>
	<tr>				
			<td  >
				<a href="javascript:alert('Order # SO71676')">SO71786</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name7">West Side Mart8</span>						
			</td>
			<td>
				<span id="GridViewSummaryResults_PO7">PO19952192041</span>	
				
			</td>
			<td>
				07/01/10
			</td>
			<td>
				$87.09
			</td>
		</tr>

	<tr class="even">				
			<td  >
				<a href="javascript:alert('Order # SO71777')">SO71778</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name8">Demand Distributors6</span>
				
			</td>
			<td>
				<span id="GridViewSummaryResults_PO8">PO20097113396</span>						
			</td>
			<td>
				&nbsp;
			</td>
			<td>
				$1,267.82
			</td>

		</tr>
	<tr>				
			<td  >
				<a href="javascript:alert('Order # SO71676')">SO71786</a>
			</td>
			<td>
				<span id="GridViewSummaryResults_name9">West Side Mart8</span>						
			</td>
			<td>
				<span id="GridViewSummaryResults_PO9">PO19952192041</span>	
				
			</td>
			<td>
				12/15/09
			</td>
			<td>
				$187.09
			</td>
		</tr>
	</tbody>
@kotarao
Copy link
Author

kotarao commented Jul 12, 2022

sorting screen shot for your reference:-
image

@Mottie
Copy link
Owner

Mottie commented Jul 13, 2022

Hi @kotarao!

Set the headers option for that column because it's not correctly auto-detecting the data type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants