How do you go about querying the ajon file to just show certain listing?

How do you go about querying the ajon file to just show certain listing?

pvtpepperpvtpepper Posts: 4Questions: 2Answers: 0

Like all listing that have PA for State. I don't want the user to have to search each time I want to have one page that shows PA then one that shows DE etc.

Thanks,

Answers

  • aaronwaaronw Posts: 89Questions: 3Answers: 4

    It depends what you're really trying to accomplish. Do you really want separate pages? Try something like this: http://datatables.net/examples/api/multi_filter_select.html so the user can pull down the state they want and then the table will re-filter based on that input

  • pvtpepperpvtpepper Posts: 4Questions: 2Answers: 0

    arronw thanks for answering.
    This is my script I have now using ajax to create the table from a json file.
    Where to plug the addtional scripting in from the example you sent at the link above.

    <script>
       jQuery(function(){
            jQuery('#datatable').dataTable({
                "ajax": "/sites/sample.json",
    
    "columns": [
                    { "data": "region" },
                    { "data": "state" },
                    { "data": "siteId" },
                    { "data": "siteName" },                
                ],
    "lengthMenu": [[10, 25, 100, -1], [10, 25, 100, "All"]]
    
        } );
    } );
     
     </script>
    

    Thanks again.

This discussion has been closed.