How To I will hide action button and my datatable?

How To I will hide action button and my datatable?

giashgiash Posts: 29Questions: 4Answers: 0


Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    Answer ✓

    Are you wanting to hide the Action column? If so use columns.visible. If this doesn't help then please provide more details of what you want with a link to your page or test case replicating what you have so we can see what you have to offer suggestions.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0

    Kevin Thanks For Response, Ok I will share my code now.
    How to Share my code here?

  • giashgiash Posts: 29Questions: 4Answers: 0

    hello Kevin please help me?

  • giashgiash Posts: 29Questions: 4Answers: 0
    edited March 2023
    <div class="card card-outline card-primary">
        <div class="card-header">
            <h3 class="card-title">List of Repairs</h3>
            <div class="card-tools">
                <a href="./?page=repairs/manage_repair" class="btn btn-primary btn-sm btn-flat"><i class="fa fa-plus"></i> Add Entry</a>
            </div>
        </div>
        <div class="card-body">
            <div class="container-fluid">
            <div class="container-fluid">
                <table class="table table-hover table-striped table-bordered">
                    <colgroup>
                        <col width="5%">
                        <col width="15%">
                        <col width="15%">
                        <col width="30%">
                        <col width="10%">
                        <col width="15%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                    </colgroup>
                    <thead>
                        <tr>
                            <th>SL.No</th>
                            <th>Received Date</th>
                            <th>Complain ID</th>
                            <th>Customer Info</th>
                            <th>Assigned Engineer Name</th>
                            <th>Repair Eng Status</th>
                            <th>Components Details</th>
                            <th>Repair Date</th>
                            <th>Repair TAT</th>
                            <th>Issuing Branch</th>
                            <th>Issuing Branch Incharge</th>
                            <th>Total Bill</th>
                            <th>RMA Status</th>
                            <th>Deliverey Date</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                            $i = 1;
                            $qry = $conn->query("SELECT r.*,CONCAT(c.lastname,', ',c.firstname,' ',c.middlename) as client from `repair_list` r inner join client_list c on r.client_id = c.id order by unix_timestamp(r.`date_created`) desc ");
                            while($row = $qry->fetch_assoc()):
                        ?>
                            <tr>
                                <td class="text-center"><?php echo $i++; ?></td>
                                <td class=""><?php echo date("d-m-Y g:i a",strtotime($row['date_created'])) ?></td>
                                <td><?php echo ($row['code']) ?></td>
                                <td class=""><p class="truncate-1"><?php echo ucwords($row['client']) ?></p></td>
                                <td class="text-center">                                
                                        <?php 
                                        switch ($row['attempt_engineer_name']){
                                            case 26:
                                                echo '<span class="rounded-pill badge badge-warning">None</span>';
                                                break;
                                            case 14:
                                                echo '<span class="rounded-pill badge badge-secondary">SK-SAYED HOSAIN-(MP)</span>';
                                                break;
                                            case 15:
                                                echo '<span class="rounded-pill badge badge-primary">Alomgiar NITC-(MP)</span>';
                                                break;
                                            case 16:
                                                echo '<span class="rounded-pill badge badge-info">Saiful Islam-(MP)</span>';
                                                break;
                                            case 17:
                                                echo '<span class="rounded-pill badge badge-warning">Pulak Sukul-Panel Dept-(Banani)</span>';
                                                break;  
                                            case 25:
                                                echo '<span class="rounded-pill badge badge-warning">AQ Tusher-MSI Dept-(Banani)</span>';
                                                break;
                                            case 32:
                                                echo '<span class="rounded-pill badge badge-warning">Tanvir Hossen-MSI Dept-(Banani)</span>';
                                                break;
                                            case 33:
                                                echo '<span class="rounded-pill badge badge-warning">SK-Alomgir-Acer Dept-(Banani)</span>';
                                                break;
                                                case 35:
                                                echo '<span class="rounded-pill badge badge-warning">SHAWON_ACER Dept-(Banani)</span>';
                                                break;
                                            case 34:
                                                echo '<span class="rounded-pill badge badge-warning">Md Hridoy Howlader-MSI Dept-(Banani)</span>';
                                                break;
                                            case 36:
                                                echo '<span class="rounded-pill badge badge-warning">MD Shoel Rana-Inch MSI Dept-(Banani)</span>';
                                                break;  
                                            case 27:
                                                echo '<span class="rounded-pill badge badge-warning">MD.GIASH UDDIN HOWLADER</span>';
                                                break;              
                                        }
                                    ?>
    
                                        <td class="text-center">
                                    <?php 
                                        switch ($row['repair_eng_status']){
                                            
                                            
                                            case 2:
                                                echo '<span class="rounded-pill badge badge-info">Under Diagnosis</span>';
                                                break;
                                            case 3:
                                                echo '<span class="rounded-pill badge badge-warning">QC Pending</span>';
                                                break;
                                            case 4:
                                                echo '<span class="rounded-pill badge badge-success">QC Passed</span>';
                                                break;
                                            case 5:
                                                echo '<span class="rounded-pill badge badge-success">Repair Complete</span>';
                                                break;
                                          
                                            case 7:
                                                echo '<span class="rounded-pill badge badge-danger">Repair Fail</span>';
                                                break;          
                                        }
                                    ?>  
                                    </td>
    
                                        <td class=""><p class="truncate-1"><?php echo ucwords($row['parts']) ?></p></td>
    
                                        <td ><?php echo date( "F d-m-y g:i a",strtotime($row['repair_date'])) ?></td>
                                        
                                        <td ><?php
                                    $date_created=date_create($row['date_created']);
                                    $repair_date=date_create($row['repair_date']);
                                    $diff=date_diff($date_created,$repair_date);
                                    echo $diff->format(" %a days");
                                    ?></td>
                                    </td>
    
                                        <td class="text-center">
                                    <?php 
                                        switch ($row['issuing_branch']){
                                            case 28:
                                                echo '<span class="rounded-pill badge badge-warning">None</span>';
                                                break;
                                            case 10:
                                                echo '<span class="rounded-pill badge badge-secondary">(Dhaka) Multiplan Center Br</span>';
                                                break;
                                            case 11:
                                                echo '<span class="rounded-pill badge badge-primary">(Dhaka) Banani Br</span>';
                                                break;
                                            case 12:
                                                echo '<span class="rounded-pill badge badge-info">(Sylhet) Westworld Shopping Complex Br</span>';
                                                break;
                                            case 13:
                                                echo '<span class="rounded-pill badge badge-warning">(Dhaka) Banani Head Office</span>';
                                                break;              
                                        }
                                    ?>
    
                                    <td class="text-center">
                                    <?php 
                                        switch ($row['issuing_branch_incharge']){
                                            case 29:
                                                echo '<span class="rounded-pill badge badge-secondary">(None)</span>';
                                                break;
                                            case 18:
                                                echo '<span class="rounded-pill badge badge-secondary">Tanjina Urmi-RMA-(MP)</span>';
                                                break;
                                            case 19:
                                                echo '<span class="rounded-pill badge badge-primary">Alomgiar-NITC-(MP)</span>';
                                                break;
                                            case 20:
                                                echo '<span class="rounded-pill badge badge-info">Saiful Islam-ENG-(MP)</span>';
                                                break;
                                            case 21:
                                                echo '<span class="rounded-pill badge badge-warning">Yousuf Ashru-RMA-(Banani)</span>';
                                                break;
    
                                            case 22:
                                                echo '<span class="rounded-pill badge badge-warning">Shibly Nomani-RMA-(Banani)</span>';
                                                break;
                                            case 23:
                                                echo '<span class="rounded-pill badge badge-warning">zahidul Islam-RMA-(Banani)</span>';
                                                break;
                                            case 24:
                                                echo '<span class="rounded-pill badge badge-warning">MD.GIASH UDDIN HOWLADER (MP/BAN)</span>';
                                                break;
                                            case 30:
                                                echo '<span class="rounded-pill badge badge-warning">Samaed-RMA-(Sylhet)</span>';
                                                break;      
                                                            
                                        }
                                    ?>
    

    Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Please provide more details of what you want to do and how this relates to Datatables. You haven't provided you Datatables config.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0




    **
    When I will Delivered button click and save my data then, I need my datatable action button is off.**

  • giashgiash Posts: 29Questions: 4Answers: 0

    Here is my Code :

    <?php $i = 1; $qry = $conn->query("SELECT r.*,CONCAT(c.firstname,', ',c.contact,' ',c.lastname,' ',c.email,' ',c.middlename) as client fromrepair_listr inner join client_list c on r.client_id = c.id order by unix_timestamp(r.date_created) desc "); while($row = $qry->fetch_assoc()): ?> <tr class="table-info"> <td class="text-center"><?php echo $i++; ?></td> <td class=""><?php echo date("F d-m-y g:i a",strtotime($row['date_created'])) ?></td> <td><?php echo ($row['code']) ?></td> <td class=""><p class="truncate-1"><?php echo ucwords($row['client']) ?></p></td> <td class="text-center"> <?php switch ($row['status']){ case 0: echo '<span class="rounded-pill badge badge-secondary">In-Progress</span>'; break; case 1: echo '<span class="rounded-pill badge badge-primary">Approved</span>'; break; case 2: echo '<span class="rounded-pill badge badge-info">Under Diagnosis</span>'; break; case 3: echo '<span class="rounded-pill badge badge-warning">QC Pending</span>'; break; case 4: echo '<span class="rounded-pill badge badge-success">QC Passed</span>'; break; case 5: echo '<span class="rounded-pill badge badge-success">Repair OK</span>'; break; case 6: echo '<span class="ml-4 rounded-pill badge badge-danger">Same Back Delivery</span>'; break; case 7: echo '<span class="rounded-pill badge badge-danger">Repair Fail</span>'; break; case 8: echo '<span class="rounded-pill badge badge-success">Delivered Done</span>'; break; case 9: echo '<span class="rounded-pill badge badge-danger">Delivered-Payment Due</span>'; break; } ?> </td>

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Doesn't look like you are using Datatables to render the button but are rendering directly into HTML. In your click event for the button, once the data is saved, apply the disabled attribute to the button. I'm not sure how Datatables is involved with this process.

    If you want us to provide a more specific answer then please post a link to your page or a test case replicating the issue so we can see your code flow.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0

    Please Check here my code zip

  • giashgiash Posts: 29Questions: 4Answers: 0
    edited March 2023

    when I will choose my delivered option, and Save my data then action button row or ID is hide.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    That is a lot of code to look through to try and understand your solution. Its very difficult to try understanding another's solution with just the code. Especially when it spans multiple files. Point us to the specific code (click event) you have questions about.

    The only Datatables code I see is this to display the table:

        $('.table').dataTable({
                columnDefs: [
                    { orderable: false, targets: 5 }
                ],
            });
    

    I don't see anything else in the code that is Datatables specific. As I said before find the click event for the button and when the data is updated apply whatever changes you want to the button. Stack Overflow is a good resource for general Javascript and jQuery questions.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0
    edited March 2023

    Ok Thanks tomorrow I will Try..

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    action button row or ID I need hide

    Are you saying you want to remove the whole row from the table? if yes, then in your click event for the action button you can get the Datatables row similar to this example. You can use row().remove() to remove the row.

    The code you are posting doesn't not provide us with the information we need. Maybe start by posting the click event handler used to process the delivered option.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0
    edited March 2023

    Action button I need to hidden, when I will clicked delivered option?
    thanks

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    PLEASE post the click event or relevant Javascript code that runs when you click the delivered option. There is too much code for us to look through to try finding this code.

    Kevin

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    edited March 2023

    I built a very simple example:
    https://live.datatables.net/galutonu/1/edit

    It removes the clicked Action button. Is this what you are looking for when processing the delivered option? If it is then maybe you can merge this into your delivered code.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0



    I need as your code,but not here when I will choose delivery option and save the data then my Action button need to hide.
    Please See the my 1,2,3 step?

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Great, I understand the screenshots you have posted multiple times. We either need a link to your page so we can follow your code in a running environment or you need to post the relevant Javascript code that runs when you click buttons 1, 2 and 3. You need to point us to the code. There is too much code for us to just look at to understand your solution.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0
    edited March 2023

    Please Check this Link
    https://newtechrsms.net/

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    I see in input asking for the Complaint ID. Please provide the steps to see the problem.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0

    please again clear me?

  • giashgiash Posts: 29Questions: 4Answers: 0

    Complaint ID is individual number like id.

  • giashgiash Posts: 29Questions: 4Answers: 0

    Do you need User and PassW?

    https://newtechrsms.net/admin/login.php

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Please provide the exact steps needed to run the test case. What exactly needs to be typed in and clicked to be able to perform steps 1, 2 and 3 above.

    Kevin

  • giashgiash Posts: 29Questions: 4Answers: 0

    here I send user and passw?

  • giashgiash Posts: 29Questions: 4Answers: 0

    hello ?

  • giashgiash Posts: 29Questions: 4Answers: 0

    Any one here? I need your help.

  • giashgiash Posts: 29Questions: 4Answers: 0
  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    You might need to wait just a little longer before bumping your post in future. If it is really urgent then the support packages might be of interest to you.

    It looks like the SO post you linked to has an accepted answer. Does that not work for you?

    I'd need a user name and password to access your site (also, I probably won't be able to do so until tomorrow now, so please don't keep bumping your post, it won't get a reply any quicker).

    Allan

Sign In or Register to comment.