Hi,
How to filter an MVC view two times. i.e.,In my MVC view ,I am showing a list of records in a table. I want to filter that table two times, first I have to search for all the records from a particular supplier, and that filtered data to be filtered again for another data say item. First I have searched the table for all the records from a particular supplier. From that sub records ,I have to show all the records having a particular item.
$m(document).ready(function () {
$m("#myFilterSup").keyup(function () {
$m.uiTableFilter($m("#myTable"), $m(this).val());
});
});
This is working fine.
Robbinson86 reputationPosted May 30, 2014, 2:56 AM EDT
What you can do you can backup the original copy of table using clone in jquery which you can restore once you get the result of your first filter and use it for next filter and so on. Below code snippet will give you an idea.
var cloneTable = jQuery("#myTable").clone(true);
Hope, this will help you out.
Please don't forget to mark as answer if this post helps you.
Jaima Joseph93 reputationPosted May 30, 2014, 4:39 AM EDT
Robbinson86 reputationPosted Jun 3, 2014, 9:06 PM EDT
Hope, this will help you to understand the concept.
Please don't forget to mark as answer if this post helps you.
Jaima Joseph93 reputationPosted Jun 9, 2014, 2:21 AM EDT
hi, I have tried the following script,can you please tell me whether this is correct or not?? Can you tell me how to assign an id to the dynamically created second table after the first filtering?
$m(document).ready(function ()
{
$m("#myFilterSup").keyup(function ()
{
var cloneTable= $m.uiTableFilter($m("#myTable"), $m(this).val()); });
var cloneTable = jQuery("#myTable").clone(true);
$m("#myFilterSKU").keyup(function ()
{ $m.uiTableFilter($m("#cloneTable"), $m(this).val());
});
});
It is not working.
Robbinson86 reputationPosted Jun 9, 2014, 3:04 AM EDT
Below may be the probable scripts to perform this. Please note that below code is not tested okay but the steps are proven.
$m(document).ready(function ()
{
// Backup table by clone it.
var cloneTable = jQuery("#myTable").clone(true);
$m("#myFilterSup").keyup(function ()
{
$m("#myFilterSKU").keyup(function ()
{
$m.uiTableFilter($m("#myTable"), $m(this).val());
// Replace my table with cloned one
("#mytable").replaceWith(cloneTable);
});
});
Hope, this will help you out. Please don't forget to mark as answer if this post helps you.
Jaima Joseph93 reputationPosted Jun 12, 2014, 3:09 AM EDT
Robbinson86 reputationPosted Jun 12, 2014, 3:20 AM EDT
don't be confused... its clone of original table which we have restored after first filter to perform second filter on original one. if you want it for further filter not to restore clone table.
does this make sense ?
Jaima Joseph93 reputationPosted Jun 12, 2014, 8:57 PM EDT