json - Get Sharepoint 2013 List Items data from certain fields with javascript and REST -


i'm trying list item data columns(fields) list.

from understand need internalname of fields want pull list data from.

edited include $expand both field , item information in 1 rest response:

edited include loop i'm using create options. i'm storing data in value, separating ?'s , splitting data html table when selected.

function execcrossdomainrequest() {      var executor;       executor = new sp.requestexecutor(appweburl);     executor.executeasync(          {              url: appweburl +                  "/_api/sp.appcontextsite(@target)/web/lists/getbytitle('weights%20and%20thickness')" +                 "?$select=fields,items&$expand=fields,items&@target='" +                  hostweburl + "'",              method: "get",              headers: { "accept": "application/json; odata=verbose" },              success: ondatareturned,              error: onerror          }      );  }   function ondatareturned(data) {      var jsonobject = json.parse(data.body);      var resultsfields = jsonobject.d.fields.results;     var resultsitems = jsonobject.d.items.results;     var calculatehtml = '';  (var = 0; < results.length; i++) {      calculatehtml = calculatehtml +          "<option value='" + results[i].mvof + "?" + results[i].oc4d + "?" + results[i].ngot + "?" +          results[i].iv4s + "?" + results[i].j6i7 + "?" + results[i].odata__x006c_yg2 + "?" +          results[i].odata__x006f_po9 + "'>" +          results[i].title +          "</option>";  }      document.getelementbyid("selectpiecedropdown").innerhtml = calculatehtml; }  

i want display data in movf, oc4d, ngot, iv4s, , j6i7 fields of items results. there ~20 more fields each items result removed them brevity. json response:

{     d: {         __metadata: {...}-         fields: {             results: [64]             0:  {...}-             1:  {...}-             2:  {...}-             3:  {...}-             4:  {...}-             5:  {...}-             6:  {...}-             7:  {                 __metadata: {...}-                 internalname: "mvof"                 staticname: "mvof"                 title: "thickness"             }         }         items: {             results: [32]             0:  {                 title: "#10 - regular"                 mvof: 0.178                 oc4d: 1.96                 ngot: null                 iv4s: null                 j6i7: null                 odata__x006c_yg2: null                 odata__x006f_po9: null             }         }     } } 

how able internalname of field, , access fields data items results? have tried: var internalthickness = resultsfields[7].internalname; trying use that: resultsitems.internalthickness returned 'undefined'

thank you, i've learned lot responses here, , links documentation. i'm having trouble piecing one.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -