jPoint 0.7 Summary of Updates

Coordinator
Nov 9, 2009 at 3:37 PM

jPoint 0.7 Summary of Updates

Improvements:
 - readForm() - identification of form fields for dispform.aspx
 - val() - reading of value from fields with no input element to support dispform.aspx
 - jPoint.strip(str) - remove special hex encoded characters
 - getSPListFields() - save additional information into list object
 - udpateItem(itemid) - process response data to save information into list object
 - getSPItem, getSPItemsWithQuery, getSPView, getSPViewCollection, getPictures - Return list object
 - getSPItemData(listObj) - use processResponseData to save information
 - getSPItems(listObj, rowLimit) - use processResponseData to save information
 - getSPViewItems(listObj) - get default view dynamically
 - buildModifyContent(listName, data) - handling when data[i].ID is not null


Newly Added Public Functions:
 - deleteItem(id) - delete SPList item
 - getSPViewCollection() - populate jPoint object with list view collection
 - filterItems(filterField, filterValue) - filter the list items where filterField contains filterValue
 - getItemsFieldData(fieldNames) - extract a subset of Items for specified fields

Newly Added Private Functions:
 - processResonseData(listObj, data) - populate jPoint.Lists.{listname} and jPoint.Lists with list information to process list web service all uniformly
 - saveListObjects(listObj, responseData) - populate jPoint.Lists.{listname} and jPoint.Lists with list information
 - getResultItems(respData) - convert response data into array of item objects
 - getColumns(items) - get complete list of columns from items array
 - buildDeleteContent(listName, id) - construct xml body for deleting SPItem from a specified list

Major jPoint.Lists Object Updates:
 When using getSPItem, getSPItemsWithQuery, getSPView, getSPViewCollection, getPictures, updateItem, addItem, and deleteItem
 jPoint.Lists["<listname>"] will have the following objects populated depending on current context
  ListName - name of last list used in uppercase
   Items - array of item object [{field11:value11,field12:value12,...},{{field21:value21,field22:value22,...}}]
        fields are based on xml response and might not be uniform across rows, so check before use
   FieldCount - count of fields
   ItemCount - count of items
   xmlDoc - xml document response from webservice call
   JQueryData - row data as jQuery object
   total - count of rs:\\data nodes if exist
   nextPage - key for paging if rs:\\data exist

Nov 10, 2009 at 5:48 AM

Ken, looks like lots of great updates. I will get to work using them.... Thanks for the continued improvement.

Dec 23, 2010 at 5:49 AM

jp.Lists.{Listname}.DeleteItem() did NOT work for me.

So , Here is my alternative solution : I am using mix of SPServices and JPoint.

My scenario is , that I have a library called "IntroductionLibrary". It should contain only 1 document at most. That requires me to delete existing document at some actions. Here I am showing only the code snippet to delete the existing document.

<script language="javascript" type="text/javascript" src="_layouts/simient/jquery-1.4.4.min.js">
</script>
<script language="javascript" type="text/javascript" src="_layouts/simient/jPoint.min.js">
</script>
<script language="javascript" type="text/javascript" src="_layouts/simient/jquery.SPServices-0.5.8.min.js">
</script>
<script type="text/javascript" language="javascript">
    $(document).ready(function() /*run script after DOM is ready */ {

        //Delete the existing video
        var thisSite = $().SPServices.SPGetCurrentSite();
        var listname = "IntroductionVideo";
        var IntroVid = jP.Lists.setSPObject(thisSite, listname);

        var viewGuid = IntroVid.getSPViewCollection().Items[0].Name;

        var qry = "<OrderBy><FieldRef Name='ID' Ascending='TRUE' /></OrderBy>";
        IntroVid.getSPItemsWithQuery(qry);
        var fieldarray = ["ID", "LinkFilename"];
        var myItems = IntroVid.getItemsFieldData(fieldarray);
        var Id = myItems[0].ID;
        var filename = thisSite + '/IntroductionVideo/' + myItems[0].LinkFilename;

        $().SPServices({
            operation: "UpdateListItems",
            async: false,
            listName: "IntroductionVideo",
            updates: "<Batch OnError='Continue' PreCalc='TRUE' ListVersion='0' ViewName='" + viewGuid + "'><Method ID='1' Cmd='Delete'><Field Name='ID'>" + Id + "</Field><Field Name='FileRef'>" + filename + "</Field></Method></Batch>",
            completefunc: function(xData, Status) {
                alert("deleted exisiting video, press OK to goto upload page");
            }
        });

    });
</script>