Accessing values from a hidden column

QuestionsAccessing values from a hidden column
Bastien Koert asked 7 years ago

Using this package. Very useful, but I'm confused about one thing. I have figured out how to hide some elements in the row (to keep it fitting to the page), but how do I access those hidden values?

For example, if I've hidden the fourth <th> element, I am trying to access it via $('#edit_position').val(ele.siblings(':nth-of-type(4)').html());

but those values are coming out undefined when I alert them out

What can I do?

2 Answers
Abu Ghufran answered 7 years ago

I am unable to understand what are you trying to achieve.
If you can share code + screenshot …. i can suggest better.

Bastien Koert answered 7 years ago

Say I have a table and result like this

<table id="employee_grid" class="table table-condensed table-hover table-striped" width="60%" cellspacing="0" data-toggle="bootgrid">
<thead>
<tr>
<th data-column-id="id" data-type="numeric" data-identifier="true" >Id</th>
<th data-column-id="employer">Company</th>
<th data-column-id="employer_website" data-visible="false">Website</th>
<th data-column-id="employer_contact">Contact Name</th>
<th data-column-id="employer_position" data-visible="false">Position</th>
<th data-column-id="employer_phone">Phone</th>
<th data-column-id="employer_email">Email</th>
<th data-column-id="emp_dates">Emp Dates</th>
<th data-column-id="start_date" data-visible="false">Employment Date</th>
<th data-column-id="end_date" data-visible="false">End Date</th>
<th data-column-id="employee_title">Candidate Job Title</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>
</thead>
</table>

The above has a few columns that are hidden (as the table is too wide). Those hidden columns have values returned from the response page. What I need to do is to be able to access the data in those hidden columns when setting up the edit modal.

$('#edit_id').val(ele.siblings(':first').html()); // in case we're changing the key
$('#edit_employer').val(ele.siblings(':nth-of-type(2)').html());
$('#edit_employer_website').val(ele.siblings(':nth-of-type(3)').html()); //hidden
$('#edit_employer_contact').val(ele.siblings(':nth-of-type(4)').html());
$('#edit_employer_title').val(ele.siblings(':nth-of-type(5)').html()); //hidden
$('#edit_employer_email').val(ele.siblings(':nth-of-type(7)').html());
$('#edit_employer_phone').val(ele.siblings(':nth-of-type(6)').html());

What I am not getting is the hidden values from the table. It seems they are not there in a hidden state where they can be accessed via the above code

Your Answer

15 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?