DataTable render table: find string and replace

DataTable render table: find string and replace

davide.mancosdavide.mancos Posts: 8Questions: 2Answers: 0

Hi all,

i have this php code and i would like to do the same thing with the use of render in datatable:
$a1=str_replace("30007","DSL_ID",$row["summary"]);
$a1=str_replace("230003","Unit ID",$a1);
$a1=str_replace("30005","Data Link Sapi ID",$a1);
$a1=str_replace("220005","Lapd & EOC interface identification",$a1);
$a1=str_replace("410001","Chassis ID",$a1);
$a1=str_replace("10004","FAN ID",$a1);
$a1=str_replace("30001","ISUP interface ID",$a1);
$a1=str_replace("30002","CIC",$a1);
$a1=str_replace("1030003","Unit ID",$a1);
$a1=str_replace("30018","MTP3 Link ID",$a1);
$a1=str_replace("30012","IP address",$a1);
$a1=str_replace("30013","IP port",$a1);
$a1=str_replace("30048","Network ID",$a1);
$a1=str_replace("10002","Slot ID",$a1);
$a1=str_replace("1110001","Chassis ID",$a1)

The result of this php code for one row is for example:
ET10007_PC40303_SP0|Chassis ID=69, FAN ID=2

can someone help me?
thanks

Answers

  • davide.mancosdavide.mancos Posts: 8Questions: 2Answers: 0

    The original row ($row["summary"]) is like this:

    ET10007_PC40303_SP0|410001=87, 10004=5

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • davide.mancosdavide.mancos Posts: 8Questions: 2Answers: 0

    Here
    live.datatables.net/vosihuha/2/edit

    a test case.

    for example, the second record is:
    ET10007_PC40303_SP0|410001=87, 10004=5

    I would like to replace dynamically 410001 in Chassis ID
    and 10004 in FAN ID

    and so on for the other records using the translation code listed in the first post

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
  • davide.mancosdavide.mancos Posts: 8Questions: 2Answers: 0

    Hi Kevin,

    Thanks a lot
    regards

This discussion has been closed.