Fetch List column data from sub site

Oct 31, 2013 at 5:24 AM
We need to fetch the list data from child site to another child site.

We know using the site column in top level site. But really we need get the list data from child site list.

ex: we have Top level site and two sub site (sub site 1, sub site 2) we need to fetch the list column data from sub site 1 in to sub site 2.

This is possible using SPServices library?

If possible please let me know how to do this..
Oct 31, 2013 at 10:58 AM
Yes, this should be possible. You need to use the webURL input param to SPServices, and set it to the appropriate sub-site.

Paul


--

_________
Paul T

Oct 31, 2013 at 11:05 AM
Edited Oct 31, 2013 at 11:06 AM
Please let me know which method we have to use in this services?
Coordinator
Oct 31, 2013 at 11:31 AM
Ditto my comment on your other thread. Read the docs.

M.
Oct 31, 2013 at 1:04 PM
Sorry. I am not understand. You mean this is possible using the same function?

$().SPServices.SPCascadeDropdowns
Coordinator
Oct 31, 2013 at 1:24 PM
Seriously, read the docs. It's GetListItems.

M.
Nov 11, 2013 at 4:39 AM
Edited Nov 11, 2013 at 5:08 AM
We are used following code and get the customer name from other site list.
<script language="javascript" type="text/javascript">

$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "{1FCCED39-5877-4241-A548-1FEDB365FDD6}",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        $("#customer").append(liHtml);
      });
    }
  });
});
</script>
<ul id="customer"/>
This data is displayed under list. But really we need to show data to drop down column

So how can we bind the data to drop down column?

Actually we have to use global customer column from one sub site list. This customer column used for all sub site list.
Coordinator
Nov 11, 2013 at 2:20 PM
You're building an unordered list with the output, but you want a select. Simply emit that markup with the values instead.

M.
Nov 12, 2013 at 5:30 AM
Edited Nov 12, 2013 at 5:31 AM
We are using choice column and bind the data. But in edit form how can we control the selected value?
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
    var x=document.getElementById("Clientle_2f2d08ee-bfdb-46e1-93ff-400d2fcee632_$DropDownChoice");
    $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "{1FCCED39-5877-4241-A548-1FEDB365FDD6}",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var option=document.createElement("option");
        option.text= $(this).attr("ows_Title");
         x.add(option,null);
      });
    }
  });
});
</script>
Coordinator
Nov 12, 2013 at 12:39 PM
Edited Nov 12, 2013 at 12:40 PM
You'd probably be better off building the control entirely client side. You can set the selected option in your script, if that's what you mean.

Without understanding all of the details, I should mention that adding arbitrary values to a dropdown that is contained in the view state will throw errors on postback.

M.
Nov 13, 2013 at 5:00 AM
Sorry I am not understand. Can you please provide the sample code?
Coordinator
Nov 13, 2013 at 10:52 AM
Since I don't really know what you're doing, it's impossible for me to provide "sample code".

M.