Skip to main content
jP_web_icon

Examples

Go Search
Home
  
Examples > src > Example_LookupList1  

Web Part Page Title Bar image
Example_LookupList1

 Example

 list1

Buenos AiresUse SHIFT+ENTER to open the menu (new window).
2
ChicagoUse SHIFT+ENTER to open the menu (new window).
1
New YorkUse SHIFT+ENTER to open the menu (new window).
1
SantiagoUse SHIFT+ENTER to open the menu (new window).
3
TexasUse SHIFT+ENTER to open the menu (new window).
1
Viña del MarUse SHIFT+ENTER to open the menu (new window).
3
Hà NộiUse SHIFT+ENTER to open the menu (new window).
11312324234234324
Hà NộiUse SHIFT+ENTER to open the menu (new window).
Việt Nam
cxzdvzxUse SHIFT+ENTER to open the menu (new window).
AtlantaUse SHIFT+ENTER to open the menu (new window).
1
BerlinUse SHIFT+ENTER to open the menu (new window).
helloUse SHIFT+ENTER to open the menu (new window).
is it me you're looking for?
pARISUse SHIFT+ENTER to open the menu (new window).

 Code

<div id="outtable"></div>
<script type="text/javascript" src="//sharejpoint.googlecode.com/files/jPointLoader.js" ></script>
<script>
$(document).ready(function(){

  var item = "Country_lookupfields";
  var tipo = "Text";
  var valor= 1;
  var query = "<Where><Eq><FieldRef Name='"+item+"' LookupId='True' /><Value Type='"+tipo+"'>"+valor+"</Value></Eq></Where>";

  var list = jP.Lists.setSPObject("/examples", "list1");
  list.getSPItemsWithQuery(query);

  var data = list.JQueryData;
  //extract data into items
  var items = {}; 
  for(var j=0; j < data.length; j++) {
    var ItemFields = data[j].attributes;
    items[j] = {};
    for (i=0; i<ItemFields.length; i++) {
      var ItemFieldName = ItemFields[i].name.replace(/ows_/i, "").replace(/_x0020_/g, "");
      items[j][ItemFieldName]=ItemFields[i].value;
    }
  }
  var out = "<table border=1>";
  $.each(items, function (i, v){
    out += "<tr><td>"+i+"</td><td>"+v.LinkTitle+"</td><td>"+v.Country_lookupfields+"</td></tr>";
  });
  out += "</table>";
  $("#outtable").html(out);
});

</script>