Can you pass the data to another view?

Can you pass the data to another view?

joepacellijoepacelli Posts: 3Questions: 2Answers: 0

So I've built a datatable which has ordering, searching for our Employee Directory.
We only have just over 300 employees so I bring the complete EmployeeModel from MVC into my view
Now the user selects the drop down over department and picks the Technology department
It filters this data fine down to 15 employees.

What I need now is the ability for the user to click a Button -> Photo Directory
This would take them to a new View with this filtered data in a photo tile format
3 across and 5 down with a Cancel and Print Button on that page

How do I pass this filtered data to this new view?
Is it possible?

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    Use rows().data() to get the table data. Pass the selector-modifier of { search: "applied" } into rows() to fetch the filtered data. Use toArray() to turn the result set into a Javascript array.

    Kevin

  • joepacellijoepacelli Posts: 3Questions: 2Answers: 0

    Thanks, this helped me find the following
    var table = $('#myTable').DataTable();
    table.rows({ search: 'applied' }).data();

    This get's me the data
    Is there a way to also get the current filters?
    I have 2 search boxes and 3 drop downs
    Searches: Name and Title
    Drop downs: Divsion, Department, Location

    What I would love is something that would return the following
    Name: A
    Department: Maintenance
    Location: Raleigh

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    You can use search(), column().search() or columns().search() as getters (without search terms) to get the current search terms. Is this what you are looking for?

    Kevin

Sign In or Register to comment.