Forum Replies Created
-
AuthorPosts
-
How would I work these into tabs? I have three accordion lists each separate from each other. I would like all three to be in a tab with the accordion. The site is setup for three web part zones and would like to have three tabs with three accordions each going across? Any ideas?
Doesn’t seem to be working, it will load on page execution. But if I change a list time in a second window the information doesn’t redraw on the other. Any help you can provide will be greatly appreciated.
Original code;
<input type=”button” value=”Click here to create a new case” onclick=”javascript:OpenPopUpPage(‘https://intelshare.intelink.gov/sites/sccnola/CDO/_layouts/15/listform.aspx?PageType=8&ListId=%7B17B1BD80%2D5B62%2D4510%2DBF0C%2DE1C22781E2DE%7D&RootFolder=’)” />
<!– Style –>
<style type=”text/css”>
.item-name2-clickableNOLA{
border-top:1px #000000 solid;
border-right:1px #000000 solid;
border-bottom:1px #000000 solid;
border-left:1px #000000 solid;
font-size:1.1em;
padding:2px 5px;
margin-top:2px;
cursor:pointer;
}
.item-narative{
display: none;
border-right:2px #000000 solid;
border-bottom:2px #000000 solid;
border-left:2px #000000 solid;
padding:3px;
}</style>
<!– HTML placeholder –><!– Script –>
https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.jsfunction getMSItems(){
var date = new Date(), dateISO = “”;
date.setDate(date.getDate()-1);
dateISO = String(date.getUTCFullYear()) + “-” + String(date.getUTCMonth()+1) + “-” + String(date.getUTCDate()) + “T00:00:00Z”;
var endpoint = “https://intelshare.intelink.gov/sites/sccnola/CDO/_api/web/lists/getbytitle(‘Marine%20Safety%20Log’)/items?$select=*,FileDirRef&$filter=((Case_x0020_Status eq ‘PENDS’) or (Date_x0020_Case_x0020_Status_x00 ge datetime'”+dateISO+”‘))&$orderby= Created desc”;
jQuery.ajax({
url: endpoint,
method: “GET”,
headers: {
“accept”: “application/json; odata=verbose”,
“content-type”: “application/jsom;odata=verbose”,
“X-RequestDigest”: document.getElementById(“__REQUESTDIGEST”).value
}
}).done(function (data) {
var b = [], url;
jQuery.each(data.d.results,function(i,item){
var bgstyle = i % 2 === 0 ? “#dce0e8” : “#f2f4f7”;
url = item.FileDirRef+”/EditForm.aspx?ID=”+item.Id;
b.push(“”+item.name2+””);
});
jQuery(“#MS_placeholder”).html(b.join(“”));
}).fail(function (err) {
jQuery(“#MS_placeholder”).html(JSON.stringify(err));
});
}function openItemInDlg(url){
SP.UI.ModalDialog.showModalDialog({“url”:url,”dialogReturnValueCallback”:function(a){
if(a === 1){
location.href = location.href;
}
}});
}
// Call function
getMSItems();New code;
<input type=”button” value=”Click here to create a new case” onclick=”javascript:OpenPopUpPage(‘https://intelshare.intelink.gov/sites/sccnola/CDO/_layouts/15/listform.aspx?PageType=8&ListId=%7B17B1BD80%2D5B62%2D4510%2DBF0C%2DE1C22781E2DE%7D&RootFolder=’)” />
<!– Style –>
<style type=”text/css”>
.item-name2-clickableNOLA{
border-top:1px #000000 solid;
border-right:1px #000000 solid;
border-bottom:1px #000000 solid;
border-left:1px #000000 solid;
font-size:1.1em;
padding:2px 5px;
margin-top:2px;
cursor:pointer;
}
.item-narative{
display: none;
border-right:2px #000000 solid;
border-bottom:2px #000000 solid;
border-left:2px #000000 solid;
padding:3px;
}</style>
<!– HTML placeholder –><!– Script –>
https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.jsvar itemsAlreadyDrawn = {};
function getMSItems(){
var date = new Date(), dateISO = “”;
date.setDate(date.getDate()-1);
dateISO = String(date.getUTCFullYear()) + “-” + String(date.getUTCMonth()+1) + “-” + String(date.getUTCDate()) + “T00:00:00Z”;
var endpoint = “https://intelshare.intelink.gov/sites/sccnola/CDO/_api/web/lists/getbytitle(‘Marine%20Safety%20Log’)/items?$select=*,FileDirRef&$filter=((Case_x0020_Status eq ‘PENDS’) or (Date_x0020_Case_x0020_Status_x00 ge datetime'”+dateISO+”‘))&$orderby= Created desc”;
jQuery.ajax({
url: endpoint,
method: “GET”,
headers: {
“accept”: “application/json; odata=verbose”,
“content-type”: “application/jsom;odata=verbose”,
“X-RequestDigest”: document.getElementById(“__REQUESTDIGEST”).value
}
}).done(function (data) {
var b = [], url;
jQuery.each(data.d.results,function(i,item){
if (itemsAlreadyDrawn[item.Id]) {
//Already drawn
return;
}
itemsAlreadyDrawn[item.Id] = true;
var bgstyle = i % 2 === 0 ? “#dce0e8” : “#f2f4f7”;
url = item.FileDirRef+”/EditForm.aspx?ID=”+item.Id;
b.push(“”+item.name2+””);
});
jQuery(“#MS_placeholder”).append(b.join(“”));
}).fail(function (err) {
jQuery(“#MS_placeholder”).html(JSON.stringify(err));
});
}function openItemInDlg(url){
SP.UI.ModalDialog.showModalDialog({“url”:url,”dialogReturnValueCallback”:function(a){
if(a === 1){
location.href = location.href;
}
}});
}
// Call function
getMSItems();
setInterval(function(data){
},500);How would I make this asynchronous. So if a new list item is added it should appear without refreshing.
Disregard I found the problem this awesome thank you so much. Beer is coming your way at my next check.
It seems the alternating row colors is preventing the titles from expanding any thoughts?
Here’s another question, hate to be a pain. If the list produces ten items how do I highlight odd rows blue and even rows red. Also If Item name contains the word bad how do I highlight that word specifically yellow?
Essentially what I need to do is run the following code in a script editor;
$(document).ready(function($){
$.ajax({
url: “http://api.wunderground.com/api/72df18b7f213607b/forecast/q/CO/Alamosa.json”,
dataType : “jsonp”,
success : function(parsed_json) {
var forecast = parsed_json[‘forecast’][‘txt_forecast’][‘forecastday’];for (index in forecast) {
var newForecastString = ‘Weather forecast for ‘ + forecast[index][‘title’] + ‘ is ‘ + forecast[index][‘fcttext_metric’];
var newForecastParagraph = $(‘<p/>’).text(newForecastString);
$(“.three”).append(newForecastParagraph);
}
}
});
});And have it display the data like so;
Weather forecast for Sunday is Scattered flurries and snow showers. High -1C. Winds NNW at 15 to 30 km/h. Chance of snow 30%.
Weather forecast for Sunday Night is Some clouds this evening will give way to mainly clear skies overnight. Low -17C. Winds NNW at 15 to 30 km/h.
Weather forecast for Monday is A mainly sunny sky. High 3C. Winds N at 10 to 15 km/h.
Weather forecast for Monday Night is Clear. Low -19C. Winds light and variable.
Weather forecast for Tuesday is Abundant sunshine. High 3C. Winds light and variable.
Weather forecast for Tuesday Night is Clear skies. Low -19C. Winds light and variable.
Weather forecast for Wednesday is Sunny. High 6C. Winds light and variable.
Weather forecast for Wednesday Night is Clear skies. Low -19C. Winds S at 10 to 15 km/h.
Clearly I am awesome at wrapping solutions together.
You are the man thank you so much. heres a quick question if there are no results to display how would a send a “no results” message to the view?
And maybe a edit icon to modify the narrative that would be amazing.
Awesome. One more request, with a provided latitude and longitude in its respective columns, can I display a google map below the narrative with a icon on the lat long center point?
The only thing I need is a 25 hour filtering option and the ability to use list views other then that this solution is spot on.
This works great thank you so much. How would I go about filtering it so only the last 25 hours (yes last 25 hours) of created items show up?
Exactly what I want to do. There is a faq accordion floating around but really whatever you come up with I would be much appreciative. Again this has bugged me for two months now. So to round up the list lives on one sub site and I want to view the display on another subsite. When the title is clicked the narrative should display below it. Thank you so much for your help and all of the great solutions to date.
I am working with sharepoint 2013. Any help is much appreciated.
-
AuthorPosts