Generate table from Source->Target JSON data, and use as table display order?

Generate table from Source->Target JSON data, and use as table display order?

coxopsengineercoxopsengineer Posts: 1Questions: 1Answers: 0

Hello,

I have some data in JSON format coming from my database that contains links, each object has a Source and Target(nbrSrcLoopback/nbrDstLoopback), in IP address format, which when laid out properly should show you what host is connected to what host and specifically in what order. Is there a way that I can create a table that creates the rows in Source to Target order? So I would expect the below data to have a table with the first row being 172.31.19.71 and next row being 172.31.50.147.

I am attaching a pic of my website to show you the current table, and also my d3.js enabled chart which is able to create the relationship with the same JSON data. As you will note my current table unfortunately is just the JSON data but in no particular order, I would like to put the table in the same order as the chart is.

{
LinkList: [
{
MarketID: "70",
nbrSrcLoopback: "172.31.19.71",
nbrDstLoopback: "172.31.50.147",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.36",
nbrDstP2P: "172.31.136.37",
nbrSrcIfaceName: "N-10G-1/1/4",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/4",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.19.72",
nbrDstLoopback: "172.31.50.144",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.45",
nbrDstP2P: "172.31.136.44",
nbrSrcIfaceName: "N-10G-1/1/4",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/4",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.144",
nbrDstLoopback: "172.31.19.72",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.44",
nbrDstP2P: "172.31.136.45",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/4",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/4",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.144",
nbrDstLoopback: "172.31.50.148",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.43",
nbrDstP2P: "172.31.136.42",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.145",
nbrDstLoopback: "172.31.50.146",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.39",
nbrDstP2P: "172.31.136.38",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.145",
nbrDstLoopback: "172.31.50.155",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.40",
nbrDstP2P: "172.31.136.41",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.146",
nbrDstLoopback: "172.31.50.50",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.89",
nbrDstP2P: "172.31.136.88",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.001G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.146",
nbrDstLoopback: "172.31.50.145",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.38",
nbrDstP2P: "172.31.136.39",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.147",
nbrDstLoopback: "172.31.19.71",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.37",
nbrDstP2P: "172.31.136.36",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/4",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/4",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.147",
nbrDstLoopback: "172.31.50.21",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.54",
nbrDstP2P: "172.31.136.55",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.148",
nbrDstLoopback: "172.31.50.144",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.42",
nbrDstP2P: "172.31.136.43",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.148",
nbrDstLoopback: "172.31.50.155",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.90",
nbrDstP2P: "172.31.136.91",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.155",
nbrDstLoopback: "172.31.50.148",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.91",
nbrDstP2P: "172.31.136.90",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.155",
nbrDstLoopback: "172.31.50.145",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.41",
nbrDstP2P: "172.31.136.40",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.21",
nbrDstLoopback: "172.31.50.147",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.55",
nbrDstP2P: "172.31.136.54",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.21",
nbrDstLoopback: "172.31.50.50",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.158",
nbrDstP2P: "172.31.136.159",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.010G",
nbrDstIfaceDesc: "12.005.ALLU.001G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.50",
nbrDstLoopback: "172.31.50.146",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.88",
nbrDstP2P: "172.31.136.89",
nbrSrcIfaceName: "N-10G-1/1/25",
nbrDstIfaceName: "N-10G-1/1/26",
nbrSrcIfaceDesc: "12.005.ALLU.001G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/25",
nbrDstPortNumber: "1/1/26",
},
{
MarketID: "70",
nbrSrcLoopback: "172.31.50.50",
nbrDstLoopback: "172.31.50.21",
nbrSrcOSPFState: "Full",
nbrDstOSPFState: "Full",
nbrSrcRSVPState: "InService",
nbrDstRSVPState: "InService",
nbrSrcP2P: "172.31.136.159",
nbrDstP2P: "172.31.136.158",
nbrSrcIfaceName: "N-10G-1/1/26",
nbrDstIfaceName: "N-10G-1/1/25",
nbrSrcIfaceDesc: "12.005.ALLU.001G",
nbrDstIfaceDesc: "12.005.ALLU.010G",
nbrSrcPortNumber: "1/1/26",
nbrDstPortNumber: "1/1/25",
},
]
}

Answers

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

    A couple options I can think of:

    1. You can create a hidden column that contains the numerical order of the table. This column can be set as the default order using order. You may also want to look at orderFixed.
    2. Use orthogonal data to set the order of the table.

    Either way you are probably going to need a field in the data that contains the order. If you are using the ajax option you could use the -ajax.dataSrc option as a function then loop through the data to determine the order. Or you could rturn the order from your server script.

    Kevin

This discussion has been closed.