How to read the re-ordered data in my controller
How to read the re-ordered data in my controller
Let me begin by saying, I am new to MVC and jQuery DataTables. I am using a service API that returns me JSON data. I put that data into a Model. Then I use datatable library with the row-reorder extension to render that Model. In terms of UI, it renders correctly and I am able to re-order the rows by dragging and dropping it. The functionality of the application is that the user can change the order of the rows and I have to send back the new order to the database using the API. Once they are done re-ordering everything, they click on an "Approve" button. My question is, how do I read the new ordered data into my Model and then access it in the controller?
Here is a sample of my Model. TermDetails is a list of terms that is rendered using DataTables. IndexTermRank is the order in which it should be displayed. This order can be modified by the user and I need to capture the new order :
{
"TermDetails": [
{
"DataHubIndexTermID": 434,
"IndexTermName": "Afterglow",
"IndexTermSrcID": "C1983",
** "IndexTermRank": 1,**
"IndexTermScore": 1.5233524103719926,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Optics and optical physics",
"IndexTermTopicSrcID": "P4276",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 435,
"IndexTermName": "Electrons",
"IndexTermSrcID": "P1641",
** "IndexTermRank": 2,**
"IndexTermScore": 1.5228812582556672,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Particle physics",
"IndexTermTopicSrcID": "P4390",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 436,
"IndexTermName": "Electron temperature",
"IndexTermSrcID": "P44387",
** "IndexTermRank": 3,**
"IndexTermScore": 1.5192410580786293,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Plasma physics",
"IndexTermTopicSrcID": "P4675",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 437,
"IndexTermName": "Electron density",
"IndexTermSrcID": "P44327",
** "IndexTermRank": 4,**
"IndexTermScore": 1.5116739953448399,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Plasma physics",
"IndexTermTopicSrcID": "P4675",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 438,
"IndexTermName": "Electron energy distribution functions",
"IndexTermSrcID": "P1600",
** "IndexTermRank": 5,**
"IndexTermScore": 1.5077841367906641,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Statistical physics",
"IndexTermTopicSrcID": "P5789",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 439,
"IndexTermName": "Langmuir probe",
"IndexTermSrcID": "P57632",
** "IndexTermRank": 6,**
"IndexTermScore": 1.5046802573704774,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Plasma physics",
"IndexTermTopicSrcID": "P4675",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 440,
"IndexTermName": "Steady?state",
"IndexTermSrcID": "P51345",
** "IndexTermRank": 7,**
"IndexTermScore": 1.2657143111157834,
"IndexTermPathAddr": "",
"IndexTermTopicName": "General physics",
"IndexTermTopicSrcID": "P2163",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 441,
"IndexTermName": "Probability functions",
"IndexTermSrcID": "P49077",
** "IndexTermRank": 8,**
"IndexTermScore": 1.0038723704224219,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Mathematical and computational physics",
"IndexTermTopicSrcID": "P3437",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 442,
"IndexTermName": "Metals",
"IndexTermSrcID": "P3537",
** "IndexTermRank": 9,**
"IndexTermScore": 0.7693618521121095,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Materials science",
"IndexTermTopicSrcID": "P3428",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
},
{
"DataHubIndexTermID": 443,
"IndexTermName": "Dissociative attachment",
"IndexTermSrcID": "P1397",
** "IndexTermRank": 10,**
"IndexTermScore": 0.7591666814842069,
"IndexTermPathAddr": "",
"IndexTermTopicName": "Chemical physics",
"IndexTermTopicSrcID": "P4547",
"IndexTermStatus": "",
"IndexTermAuthorComment": ""
}
]
}