I 've tried a lot of ways to put a client id or css class in <th> tags, but i haven't succeeded what i did. In fact, i want to specify class or id for each <th>. Normally there is columnHeader property for but when i want to use it i am getting a "Attribute headerClass invalid for tag column according to TLD" error. <datatable headerClass> only allows a general description (for all <th>). When I use <h: outputText styleClass>, it writes into <span> . Is there another way to ensure this?
First I have to ask why you need to do this. If you're expecting to be taking action in the backing bean based on a cell's ID, you should be warned that it's A) ugly, B) difficult, C) unreliable and most importantly D) probably something you should be doing using a DataModel.
The id of your JSF elements in your View Template is not the same id that will appear in the generated HTML that renders from the template. The raw HTML has IDs that are synthesized from the ID of the element plus the IDs of its parent elements. That ID is not formed according to standardized rules, so it may vary depending on the version of JSF you are using, the webapp server/JSF implementation you are using, and may change unpredictably if you edit the View Template.
Any View element may have an id field, but whether generated HTML elements will or will not and what those IDs will be is less predictable. So be very certain before attempting to do anything with them.
An IDE is no substitute for an Intelligent Developer.
posted 1 year ago
Firstly thanks for your reply. I understand, but i want to use dragtable.js plugin on DataTable because of change the order of columns and id (specially) or class properties are need for saving status.