Ajax Json data using some Tables with options

Ajax Json data using some Tables with options

peacefullpeacefull Posts: 4Questions: 1Answers: 0

Hi all,

This is my first post here, so i will try to be the more explicit as possible !

In my project i'm using your great DataTables to display my values, these latter are retrieved from an PHP echo json_encode. The PHP page is a script that return a json like this :

{
  "sig1_re": [
    {
      "Ticket_RT": 716771,
      "Cable_de_renvoi": 45,
      "Longueur_de_ligne_(Selt)": 50,
      "Res_LigneCoupee": "short",
      "Ticket_fils": 152321,
      "Numero_ND": "",
      "Gamot_DateFermeture": "",
      "Difference_de_date": "",
      "Supprimer": "<a class='delete'><button>Delete</button></a>"
    },
    {
      "Ticket_RT": 716760,
      "Cable_de_renvoi": 45,
      "Longueur_de_ligne_(Selt)": 67,
      "Res_LigneCoupee": "open",
      "Ticket_fils": "",
      "Numero_ND": "",
      "Gamot_DateFermeture": "",
      "Difference_de_date": "",
      "Supprimer": "<a class='delete'><button>Delete</button></a>"
    }
  ],
  "bad_nd": [
    {
      "Ticket_RT": 716620,
      "Numero_ND": 236598741,
      "Supprimer": "<a class='delete'><button>Delete</button></a>"
    },
    {
      "Ticket_RT": 716577,
      "Numero_ND": 565231583,
      "Supprimer": "<a class='delete'><button>Delete</button></a>"
    }
  ]
}

In my first attempt i code one JS file for each table in my HTLM and that works great but the inconvenient is that I repeat a lot of times the same code and call the JSON echo each time too. So i decided to regroup all my code in one JS file that will do the job !

And that's where the problems start lol

I managed to export almost all the tables options but I'm having a trouble to define some variables, one is to hideFromExport because in my case i need only to copy the values from the first columns when i click on "COPY" button, the second problem is with oTable which allows to delete the row. I would like to set these two things to be compatible with all my tables (in my below example i sue only two tables but in real i have more).

If someone with more skils can put me in the right way or give me the solution i will appreciate it. Thanks you in advance for the help.

my example : http://live.datatables.net/peceqofo/1/edit

Best regards.

Answers

This discussion has been closed.