Showing posts with label Dynamic Search. Show all posts
Showing posts with label Dynamic Search. Show all posts

Monday, February 11, 2013

Sharpeoint internal names display..

<select id="spLists" onchange="displayFieldData(this.options[this.selectedIndex].value)"/>
<div id="spListsSelected"></div>
<table id="spListFieldTable" cellpadding="0" cellspacing="0" style="width: auto"></table>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
var siteURL = 'http://' + window.location.host + L_Menu_BaseUrl + '/_vti_bin/lists.asmx';
$(document).ready(function(){
 var soapEnv = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
     <soap:Body> \
     <GetListCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/' /> \
     </soap:Body> \
     </soap:Envelope>";
 $.ajax({
  url: siteURL,beforeSend: function(xhr) {
   xhr.setRequestHeader("SOAPAction",
   "http://schemas.microsoft.com/sharepoint/soap/GetListCollection");
  },
  type: "POST",
  async: false,
  dataType: "xml",
  data: soapEnv,
  complete: processResult,
  contentType: "text/xml; charset=\"utf-8\""
 });
});
function processResult(xData, status) {
 $("#spLists").append("<option>Select a List</option>");
 $(xData.responseXML).find("List").each(function() {
 var liHtml = "<option value='" + $(this).attr("Title") + "'>" + $(this).attr("Title") + "</option>";
 $("#spLists").append(liHtml);
 });
}
function displayValue(splistname) {
 $("#spListsSelected").text(splistname);
}
</script>
<script type="text/javascript">
var arrSkipFieldTypesOf = ['Computed'];
var arrIncludeOverrideFields = ['Title','Author','Created','Modified','Editor'];
function displayFieldData(listname) {
 if(listname == "" || listname == undefined) return false;
 var soapEnv = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
     <soap:Body> \
     <GetList xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
     <listName>" + listname + "</listName> \
     </GetList> \
     </soap:Body> \
     </soap:Envelope>";
 $.ajax({
  url: siteURL,
  beforeSend: function(xhr) {
  xhr.setRequestHeader("SOAPAction",
  "http://schemas.microsoft.com/sharepoint/soap/GetList");
  },
  type: "POST",
  async: false,
  dataType: "xml",
  data: soapEnv,
  complete: processResult2,
  contentType: "text/xml; charset=\"utf-8\""
 });
}
function processResult2(xData, status) {
 $("#spListFieldTable tr").remove();
 $("#spListFieldTable").append("<tr style='font-weight:bold;'><td style='padding-right:10px'>DisplayName</td><td style='padding-right:10px'>FieldInternalName</td><td style='padding-right:10px'>FieldType</td></tr>");
 $(xData.responseXML).find("Field").each(function() {
  if (($.inArray($(this).attr('Name'),arrIncludeOverrideFields)>-1) || ($(this).attr('FromBaseType')!='TRUE' && $(this).attr('Sealed')!='TRUE' && $(this).attr('DisplayName')!=undefined && $.inArray($(this).attr('Type'),arrSkipFieldTypesOf)==-1)) {
   var trHtml = "<tr>";
   trHtml += "<td style='padding-right:10px'>" + $(this).attr("DisplayName") + "</td>";
   trHtml += "<td style='padding-right:10px'>" + $(this).attr("Name") + "</td>";
   trHtml += "<td style='padding-right:10px'>" + $(this).attr("Type") + "</td>";
   trHtml += "</tr>";
   $("#spListFieldTable").append(trHtml);
  }
 });
 $("#spListFieldTable tr:odd").css("background-color","rgb(206,206,206)");
}
</script>

Tuesday, July 24, 2012

Dynamic Search

Have fun!!

<SCRIPT type="text/javascript"src="SITE/Shared%20Documents/Lib/js/jquery-1.7.1.min.js"></SCRIPT>
<SCRIPT type=text/javascript>
jQuery(document).ready(function($){
    //attach a function to the keyup event on the filter box
    $('#filterInput').keyup(function()
    {
        DynamicFilter($('#filterInput').val());
    });
})
//strip off html taqs
function stripHTML (field) {
    return field.replace(/<([^>]+)>/g,'');
}
function DynamicFilter(text)
{
    //find out list view (default class for a listview is "ms-listviewtable"
    $('table [class="ms-listviewtable"]').find('tr').each(function()
        {
            //don't filter out the header row
            if ($(this).attr("class") != "ms-viewheadertr ms-vhltr")
            {
                //get the html for the row and strip off the html tabs
                source = stripHTML($(this).html());
               
                //check to see if the filter text exists in the remaining text
                if (source.indexOf(text) < 0)
                {
                    //hide the row if it doesn't contain the text
                    $(this).hide();
                } else {
                    //otherwise show it
                    $(this).show();
                }
            }
        }
    );
}
</script>
<div id="mainDiv">
    <table>
        <tr>
            <td class='Filter' width='125px'>Search: <input type="Text" id="filterInput" ></td>
        </tr>
    </table>
</div>

Followers

No Locks without Key

🌿 Bible Verse 1 Corinthians 10:13 "No temptation has overtaken you except what is common to mankind. And God is faithful; ...

Who Am I?

My photo
What is mankind that you are mindful of them, human beings that you care for them? Psalms 8:4 But he made us a little lower than Angels and Crowned with Glory and Honor. How majestic is your name in all the Earth Oh Lord our God!