we have webpart that fetch the data from the sharepoint list
camlQuery.set_viewXml("<View></View>); now i am trying to do sort the display by enddate (ascending order)
camlQuery.set_viewXml("<View><Query><OrderBy><FieldRef Name='EndDate' /></OrderBy></Query></View>"); i am using the above caml query but it is not working , can you please help me out.
my code
function GetCTItems() { var context = new SP.ClientContext(); var oList = context.get_web().get_lists().getByTitle('sharepointLst'); var camlQuery = new SP.CamlQuery(); //camlQuery.Query=("<OrderBy><FieldRef Name='EndDate' Ascending = 'FALSE'/></OrderBy>"); camlQuery.set_viewXml("<View><Query><OrderBy><FieldRef Name='EndDate' Ascending='True' /></OrderBy></Query></View>"); var CTCollection = oList.getItems(camlQuery); context.load(CTCollection); context.executeQueryAsync(function () { var htmlString = ""; var listItemEnumerator = CTCollection.getEnumerator(); 