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

Hiding column #2468

Closed
krisrajz opened this issue Jul 14, 2016 · 14 comments
Closed

Hiding column #2468

krisrajz opened this issue Jul 14, 2016 · 14 comments
Labels
awaiting reply Issues that are awaiting reply, will be closed if there is no any response in 7 days. help-wanted Issues we need or would love help from the community to resolve. needs example Need an example in order to confirm the issue or the PR.

Comments

@krisrajz
Copy link

Is there a way to dynamically hide/unhide a column using jquery?

@djhvscf
Copy link
Collaborator

djhvscf commented Jul 14, 2016

@djhvscf djhvscf added the help-wanted Issues we need or would love help from the community to resolve. label Jul 14, 2016
@djhvscf
Copy link
Collaborator

djhvscf commented Jul 14, 2016

@krisrajz Please double check the documentation: http://bootstrap-table.wenzhixin.net.cn/documentation/

@krisrajz
Copy link
Author

My table does not have any column menu list

@djhvscf
Copy link
Collaborator

djhvscf commented Jul 14, 2016

@krisrajz please provide a fiddle

@djhvscf djhvscf added awaiting reply Issues that are awaiting reply, will be closed if there is no any response in 7 days. needs example Need an example in order to confirm the issue or the PR. labels Jul 14, 2016
@wenzhixin
Copy link
Owner

http://issues.wenzhixin.net.cn/bootstrap-table/#methods/showColumn-hideCoulumn.html

@lanten
Copy link

lanten commented Jul 18, 2016

@wenzhixin
Is there a way to manipulate multiple columns?

@wenzhixin
Copy link
Owner

I think it does not support manipulate multiple columns. @lanten

@krisrajz
Copy link
Author

krisrajz commented Jul 18, 2016

It does not work for me, hence I am trying to set columns and data fields dynamically. I have set columns this way:
#1 columns: ["Category Description", "Report", "Report Description"]
#2 columns: ["Category","Category Description", "Report", "Report Description"]

but not sure how to set data field?
Any help would be appeciated.

@wenzhixin
Copy link
Owner

Please provide a jsFiddle to show your problem, thanks!

@krisrajz
Copy link
Author

http://jsfiddle.net/djhvscf/e3nk137y/7585/ (created by djhvscf some time ago for me, thanks djhvscf)

Or, is there a way to define the columns during runtime?

@wenzhixin
Copy link
Owner

Do you mean refreshOptions ?

@krisrajz
Copy link
Author

I just want to select hide a particular column programmatically upon user choose different options. Only one boostrap table is used as almost all the columns are same except one column. Depending on the user's choice I want to hide the column. Since hideColumn does not work for me, I would like to know other workarounds such as defining columns based on user choice using juqery.

I don't want to define columns this way:

Category Report

I want to define them somewhere here:

$('#tblSearch').bootstrapTable("destroy").bootstrapTable(
{
//url: DIServiceBaseURL + DIServiceURL,
data: data,
dataType: 'json',
cache: false,
pageSize: 7,
viewrecords: true,
showHeader: true,
pagination: true
});

@krisrajz
Copy link
Author

krisrajz commented Jul 22, 2016

Here's the modified table I am using:

<div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Search Reports</h4>
            </div>
            <div class="modal-body">
                <!-- search grid begin-->
                <div class="row" id="searchRow">
                    <table id="tblSearch" class="table table-condensed table-hover table-striped">
                    <thead>
                        <tr>
                            <th data-field="Category" class="col-md-2" data-sortable="true">Category</th>
                            <th data-field="CategoryDescription" class="col-md-3">Description</th>
                            <th data-field="Report"  class="col-md-2" data-sortable="true" data-formatter="ReportLinkFormatter">Report</th>
                            <th data-field="ReportDescription" class="col-md-3">Description</th>
                            <th data-field="Tags" class="col-md-2">Tags</th>
                        </tr>
                    </thead>
                </table>
              </div>
            </div>
            <!-- search grid end-->
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

@krisrajz
Copy link
Author

I am looking out for something like this:
http://stackoverflow.com/questions/27915296/how-to-refresh-bootstrap-table-data

I do not know how to use refreshOptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reply Issues that are awaiting reply, will be closed if there is no any response in 7 days. help-wanted Issues we need or would love help from the community to resolve. needs example Need an example in order to confirm the issue or the PR.
Projects
None yet
Development

No branches or pull requests

4 participants