-
Notifications
You must be signed in to change notification settings - Fork 753
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
0 : { sorter: false } option disable all the elements inside that column #1510
Comments
any pointers/expert comment kindly suggest |
Hi @gitpuneetsvyas! I'm not completely sure what you're asking. I've never seen tablesorter v1.1.0, the earliest version I've ever worked on was v2.0.5b. Are you sure you're using tablesorter? |
Yes sir |
Hi Mottie, this is the example i created using old version of jquery and table sorter which we are using i want to keep drop down enabled while disabling the sorting on that column . |
That older version doesn't ignore form elements within the header. It was fixed in v2.17.1; but I would recommend updating to the latest version. |
Thanks sir is there any other way or workaround to do so without changing the version;i tried with JQUERY/DOM way of enabling the drop down however i didn't have any good luck. |
I have replaced my old version jquery.tablesorter.js with new version but i was not seen drop down being enabled nor i see sorting images(asc and dsc) being applied on the column. |
Look in the developer console (press F12, console tab) for any errors. Then share any error messages here, and please provide the code you're using to initialize tablesorter. |
I don't see any error on console; $("table.tablesorter").customTableSorter({
hideSearchResultsLabel: true,
columnSorting: {
/* Checkboxes */ 0: { sorter: "checkbox" },
/* Demo Form Number */ 1: { sorter: "digit" },
2: { sorter: false },
/*2:{sorter: "select"} ,*/
/* Start Date */ 4: { sorter: "digit" },
/* End Date */ 5: { sorter: "jdquoteDate" }
},
cancelSelection :false
});
});
})(jQuery); |
customTableSorter .js file code ;(function($){var
rgxJdquoteDate=/(\d{1,2})[-/]?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[-/]?([12]\d{3})/i,rgxCheckboxHTML=/<input(?:[^>"']|(?:\"[^"]*\")|(?:\'[^']*\'))+type=(['"]?)checkbox\1(?:[^>"']|(?:\"[^"]*\")|(?:\'[^']*\'))*>/i,rgxChecked=/checked/i;$.tablesorter.addParser({id:'jdquoteDate',is:function(s){return s.match(rgxJdquoteDate)?true:false;},format:function(s){var matches=s.match(rgxJdquoteDate)||["","","",""],day=matches[1],month=matches[2].toLowerCase(),year=matches[3],regularDate=new Date();if(month=="jan"){month=1;}else if("feb"==month){month=2;}else if("mar"==month){month=3;}else if("apr"==month){month=4;}else if("may"==month){month=5;}else if("jun"==month){month=6;}else if("jul"==month){month=7;}else if("aug"==month){month=8;}else if("sep"==month){month=9;}else if("oct"==month){month=10;}else if("nov"==month){month=11;}else if("dec"==month){month=12;}else{return 0;}
regularDate.setFullYear(year,month,day);return regularDate;},type:'numeric'});$.tablesorter.addParser({id:'checkbox',is:function(s){return rgxCheckboxHTML.test(s);},format:function(s){return rgxChecked.test(s)?1:0;},type:'numeric'})
$.fn.jdquoteTableSorter=function(options){this;options=$.extend({},$.fn.jdquoteTableSorter.defaults,options);return this.each(function(){var $table=$(this),rowCount=$table.find("TBODY TR").length,colCount=$table.find("THEAD TR:first TH").length,headersOptions={},i,pagerSelector="#pager";if(!$table.is("table.tablesorter")){return;}
if(options.hideSearchResultsLabel){$("DIV.tablesorterCaption H3").hide();}
if(options.maximumRowCount<=rowCount){for(i=0;i<colCount;i++){headersOptions[i]={sorter:false};}}
else{headersOptions=options.columnSorting;}
$table.tablesorter($.extend({},options.tableSorterOptions,{headers:headersOptions}));if(!options.sortWithDirtyCache){$table.bind("sortStart",checkDirtyCache).find("input").bind("change",function(){$table.data("dirtyCache",true);}).end();}
if(10<rowCount){$table.tablesorterPager({container:$(pagerSelector),positionFixed:false});if(options.submitAllFormElements){$table.parents("FORM").bind("submit",handleSubmit).bind("submitCancel",handleSubmitCancel);}}
else{$(pagerSelector).hide();$table.bind("rebuildPagedCache",function(event){$(this).trigger("update");});}});};$.fn.jdquoteTableSorter.defaults={hideSearchResultsLabel:false,maximumRowCount:20000,columnSorting:{0:{sorter:"digit"}},tableSorterOptions:{widthFixed:false,widgets:['zebra']},submitAllFormElements:true,sortWithDirtyCache:false};function handleSubmit(event){this;var $this=$(this),$table=$this.find("TABLE.tablesorter");if(!event.isDefaultPrevented()){$table.each(function(){this;var $this=$(this);$this.find("TBODY").hide();$this.trigger("removePagination");});}}
function handleSubmitCancel(event){this;var $this=$(this),$table=$this.find("TABLE.tablesorter");event.preventDefault();$table.each(function(){this;var $this=$(this);$this.find("TBODY").show();$this.trigger("restorePagination");});}
function checkDirtyCache(event){this;var $this=$(this);if($this.data("dirtyCache")){$this.trigger("rebuildPagedCache");$this.data("dirtyCache",false);}}})(jQuery);
|
I updated this demo to use tablesorter v2.17.1 to show that everything works... The custom code above shouldn't effect the select. I'd still recommend using at least jQuery v1.12.4 and tablesorter v2.29.5. |
Thanks Mottie since i am using legacy app we are bound to not change the table sorter version. |
Please suggest work around to enable dropdown `
)); ` |
Kindly suggest |
There's nothing I can suggest to do with options or additional code with the version of tablesorter being used, as the problem is the internal code and how it doesn't account for form elements in the header cells. It really comes down to three choices:
|
Could you please suggest which part of the table sorter plugin i will need to modify so that drop down will be enabled. |
Wow, okay... In the demo you shared, a minified version of 2.1.2 is being used which would be very difficult to read and modify, so get the unminified version here.
Please be aware that this change is very specific to the demo you shared. It won't work if the column with a select is not disabled or if it contains any other form element (e.g. input or button). |
thanks very much for your time and support it's working fine now;your help is very much Appreciated!!!! |
Hi Mottie, |
this is the code
|
Kindly help appreciate your time and help!!!! |
If the entire table or any content within the You might want to also double check the rendered HTML because the HTML shared above has a mysterious trailing |
I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread. |
Many Many Thanks it is working fine now; |
Hi Mottie, <TABLE width="100%" border="0" cellpadding=" 0" cellspacing="0">
<tr>
<td align="left" valign="top"><!-- header row -->
<jsp:include page="fragments/header.jsp" flush="false"></jsp:include>
</td>
</tr>
</TABLE>
<body onload="generatePOPDF()">
<%-- IE8 Compatibility Fix--%>
<form style="margin-top:0;" name="searchForm" id="searchForm" method="post">
<table border="0" cellspacing="0" class="layout" width="100%">
<tr>
<input type="hidden" name="dirtyFlagForAlert">
<input type="hidden" name="userAction" value="" />
<input type="hidden" name="pageName" value="currentRentals" />
<input type="hidden" name="pageNumber"/>
<!-- page content -->
<td id="leftColumn" nowrap="nowrap">
<jsp:include page="fragments/leftNavigation.jsp" flush="false"></jsp:include>
</td>
<!-- page content -->
<td id="rightColumn">
<!-- page content -->
<h1><jdquote:label key="${Constants.MY_CUR_RENTL_AGRMNT}"/></h1>
<div class="tablesorterCaption">
<div id="pager" class="tablesorterPager">
<fieldset><legend><jdquote:label key="${Constants.PAGER}"/></legend>
<img src="${rentalAgreementsSearchBean.cssPath}/tablesorter/images/first.png" class="first" alt='<jdquote:label key="${Constants.FIRST}"/>' />
<img src="${rentalAgreementsSearchBean.cssPath}/tablesorter/images/prev.png" class="prev" alt='<jdquote:label key="${Constants.PREVIOUS}"/>' />
<input type="text" disabled class="pagedisplay"/>
<img src="${rentalAgreementsSearchBean.cssPath}/tablesorter/images/next.png" class="next" alt='<jdquote:label key="${Constants.NEXT}"/>' />
<img src="${rentalAgreementsSearchBean.cssPath}/tablesorter/images/last.png" class="last" alt=<jdquote:label key="${Constants.LAST}"/> />
<select class="pagesize">
<option value="10" selected="selected">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
</fieldset>
</div>
</div>
<div id="rentalStatusResults"><!-- US58873 START-->
<jsp:include page="MyRentalStatus.jsp" flush="false" />
</div><!-- US58873 END-->
</tr>
</table>
</form> Content of Included JSP <table id="mytable" class="tablesorter">
<thead>
<tr class="columnHeaders">
<th> </th>
<th><jdquote:label key="${Constants.NMBR}"/></th>
<%if(rentalAgreementsSearchBean.isRegion4User()) { %><!-- US49071 - START -->
<!--US58873-START-->
<th style="width:25%" align="left" class="rentalStatus" id="byRentalStatus">
<jdquote:label key="${Constants.STATUS}"/><select disabled="false" align="right" id="rentalStatus" onChange="filterRentalAgreementByStatus('filterDataForMYRental','SearchRentalAgreementsServlet');">
<c:forEach var="rentalStatus" items="${RentalAgreementsSearchBean.rentalStatusList}">
<option value="${rentalStatus.code}" ${rentalStatus.code==filterRentalStatusId ? 'selected="selected"':""}>${rentalStatus.getDescription()}</option>
</c:forEach>
</select>
</th>
<!--US58873-End-->
<% } %> <!-- US49071 - END -->
<th><jdquote:label key="${Constants.JDQ_LSE}"/></th>
<th><jdquote:label key="${Constants.PRODUCTS}"/></th>
<th><jdquote:label key="${Constants.RATE}"/></th>
<th><jdquote:label key="${Constants.DAY_OUT}"/></th>
<th><jdquote:label key="${Constants.DT_DUE_BK}"/></th>
</tr>
</thead>
<%if(rentalAgreementsSearchBean.getNumber().length > 0) { %>
<tfoot>
<tr id='deleteButton' class="action" >
<td colspan="6">
<a href='#' class="linkSelect" onclick="javascript:deleteRentals();" ><%=IfcStringLiterals.SEARCH_QUOTE_PAGE_DELETE_SELECTED %></a>
<!-- <input type="button" value="Delete Selected" onclick="javascript:deleteRentals()"> -->
</td>
</tr>
</tfoot>
<% } %>
<!-- start results -->
<tbody>
<!-- Commenting old code for rendering search results -->
<%if(rentalAgreementsSearchBean.getNumber().length ==0) { %>
<tr style="display: none;">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="orderFormSearchResultRow">
<td colspan="6" align="center"><jdquote:label key="${Constants.NO_CUR_RNTL_AGRMNT_EXSTS}"/></td>
</tr>
<%}else{%>
<% for(int i=0; i<rentalAgreementsSearchBean.getNumber().length; i++) { %>
<tr class="orderFormSearchResultRow">
<td class="deleteSelected">
<input type='checkbox' id='selectedRentals<%=rentalAgreementsSearchBean.getPurchseOrderIds()[i]%>' name='selectedRentals' onclick="setDirtyFlagForAlert(document.forms[1]);" value="<%=rentalAgreementsSearchBean.getPurchseOrderIds()[i]%>">
</td>
<td class="orderFormNumber">
<a href="MaintainRentalAgreementServlet?userAction=viewSelectedRentalAgreementFromSearch&orderId=<%=rentalAgreementsSearchBean.getPurchseOrderIds()[i] %>" onClick="javascript:blockBackGround();">
<jdquote:label key="<%= rentalAgreementsSearchBean.getNumber()[i]%>"/>
<%-- <c:out value="<%= rentalAgreementsSearchBean.get(i).getNumber()%>"/> --%>
</td>
<!-- US49071 - START -->
<c:choose>
<c:when test="${region4User}">
<td class="rentalStatus"><%= rentalAgreementsSearchBean.getStatus()[i]%> </td> <!-- US49071 -->
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
<!-- US49071 - END -->
<td class="customerName"><%= rentalAgreementsSearchBean.getCustomer()[i]%> </td>
<% String[] product = (String[])rentalAgreementsSearchBean.getProducts().get(i); %>
<td title="<%=product[1]%>" ><%= product[0]%> </td>
<td><%= rentalAgreementsSearchBean.getRates()[i]%> </td>
<td class="dateColumn"><%= rentalAgreementsSearchBean.getStartDates()[i]%> </td>
<td class="dateColumn"><%= rentalAgreementsSearchBean.getEndDates()[i]%> </td>
</tr>
<% } %>
<%} %>
</tbody>
</table> |
any pointers? |
This is not the proper support channel to get help with how to write code, this is for bug support with the current released version of the code. You've already noted that you are using an outdated legacy version, we can not provide support for this. And for context, tablesorter v2.06 was released on Jun 22, 2011 - 6 years, 8 months, 26 days ago! so your version is even older. |
I need more info:
|
thanks mottie for Pointers it is working fine now table.trigger()'update') after ajax response was causing the problem.thanks for your time and support |
Hi Mottie,
suppose you have which includes a drop down and a label making 0 : { sorter: false } makes disable the entire th locked i want drop down to be keep displaying while sorting should be disabled i am using tablesorter 1.1.0 version since this is a legacy app.
my sample code
The text was updated successfully, but these errors were encountered: