sql - Sorting jtable data from database by clicking on table header java -


i have created program connects server database , retrieves information based on search criteria entered user, placed jtable.

the user able click on column headers of jtable , sort data accordingly.

this code have unfortunately nothing when clicking on header:

pst = conn.preparestatement(sql); rs = pst.executequery(); if (rs.next()) {     tblr.setmodel(dbutils.resultsettotablemodel(rs));     tblr.setautocreaterowsorter(true); } else {     joptionpane.showmessagedialog(null, "no matches found according search criteria. please make sure entered data correct."); } 

does line tblr.setautocreaterowsorter(true) not work in case? how can work?

i found own error.

i had not placed jtable in jscrollpane , therefore method not working.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -