Quantcast
Channel: SharePoint 2013 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 21070

How to load and display SharePoint list items baded on Selected Item using JavaScript in Content Editor Webpart

$
0
0

Hi, I have a list name=  'Customer Link'.

And have the List columns:

Title:

            1. Customer A    --------English

            2. Customer B  ---------French

            3. Customer C  ---------English

            4. Customer D----------French

Language:(Type Choice)

               1. English

               2. French

URL:

if I select the Language=English, then I need to load and display only the items value = English.

i.e  1. Customer A and

      2. Customer C.

Here is my code:

<script type="text/javascript" src="https://Site Coll URL/Style Library/jquery.min.js"> </script>

<script type="text/javascript" src="https://Site Coll URL/Style Library/jquery.SPServices.min.js"> </script>

<script type="text/javascript">

$(document).ready(function() {

var SOStatusreports=[]

  $().SPServices({

    webUrl: "http://weburl/"

    operation: "GetListItems",

    async: false,

    listName: "Your-List-Name",

    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Attachments' /><FieldRef Name='Modified' /><FieldRef Name='Link' /></ViewFields>",

    CAMLQueryOptions: "<QueryOptions><IncludeAttachmentUrls>True</IncludeAttachmentUrls></QueryOptions>",

    completefunc: function (xData, Status) {

      $(xData.responseXML).SPFilterNode("z:row").each(function(index) {

               

      SOStatusreports.push($(this).attr("ows_Attachments").replace(';#',''))

                                var trimurl= SOStatusreports[index];

                               itmurl = trimurl.replace(';#','')

        var liHtml = "<li><a href='"+itmurl+"'>" +$(this).attr("ows_Title") + "</a></li>";

        $("#MyListItems").append(liHtml);

      });

    }

  });

});

</script>

How to implement?

Any help will be appreciated.


Viewing all articles
Browse latest Browse all 21070

Trending Articles