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.
Jaima JosephPosted Jun 13, 2014, 12:57 AM
RobbinsonPosted Jun 12, 2014, 7:20 AM
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 JosephPosted Jun 12, 2014, 7:09 AM
RobbinsonPosted Jun 9, 2014, 7:04 AM
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 JosephPosted Jun 9, 2014, 6:21 AM
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.
RobbinsonPosted Jun 4, 2014, 1:06 AM
Hope, this will help you to understand the concept.
Please don't forget to mark as answer if this post helps you.
Jaima JosephPosted May 30, 2014, 8:39 AM
RobbinsonPosted May 30, 2014, 6:56 AM
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.