Search This Blog

Thursday, May 30, 2019

How to apply Custom Styles to Page Layouts in SharePoint

Welcome to  designer dairy blog, here we are going to  discuss How to apply Custom Styles to Page Layouts in

SharePoint


Step1:

We refer the css styles  in the masterpage, so that style applicable in all the pages. There may be situation comes , we want to override  the css file in the pages, which comes from masterpage.

Step2:

To override the styling in the particular page, best way to edit the page-layout of the particular page.

If you go "_Catlog/masterpage" You can find the pagelayouts in both .html and .aspx.

For example:

I have page called about.aspx, i want to change the style of the page. So i have to go pagelayouts and edit the aboutpagelayout.html file.


In your custom Page Layout, search for id=”PlaceHolderAdditionalPageHead“. You’ll find it in an opening tag that looks like this:


<!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">-->
     <!--MS:<style type="text/css">--> 
          #wr_leftNav { display: none !important; } 
     <!--ME: </style>-->
So i have added the Inline-style above the contentplaceHolder, Based on your needs 
You can also add the Css reference link as below

<!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">-->
 <link href="indigo_layout.css" rel="stylesheet" type="text/css" ms-design-css-conversion="no" />
Step3:

Step3:

Thanks for reading the article.Stay Tuned on www.webdesignersdairy.com  for more updates on Sharepoint.

Tuesday, May 28, 2019

Getting the id of the Input field value where the ID's are bind dynamically

Step1:

Welcome to designer dairy, here we are going to discuss how to get the id of the input field where the id gets bind dynamically on run time

Step2:

Let’s see how the jQuery.each() function helps us in conjunction with a jQuery object. The first example selects all the TD elements in the page and outputs their Iattribute.

<script>
$(document).ready(function()
{
$('td input').each(function(i)
{
  var id = $(this).attr('id');
  console.log(id);

});
});
</script>

Note:

$(this)  - >  iterate each item of the array.

If you use $('td input'), instead of $(this) you will be getting the first value not the second value.


Step3:

Entire Mark-up design

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$('td input').each(function(i)
{
  var id = $(this).attr('id');
  console.log(id);

});
});
</script>

</head>
<body>

<table>
<tr>
<td>
<input type="checkbox" class="checkbox flat-red" id="UpcomingTaskMarkasComplete-244"
style="position: absolute; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%;
height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
<td>
<td>
<input type="checkbox" class="checkbox flat-red" id="UpcomingTaskMarkasComplete-245"
style="position: absolute; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%;
height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
<td>
</tr>
</body>
</html>

Thursday, May 16, 2019

Redirect parent window from an iframe action uisng Javascript

Welcome to  designer dairy blog, here we are going to  discuss how to Redirect parent window from an iframe action

Step1:

Example.html is the main page and  we are loading "example1.html" via an iframe tag.

Example.Html Mark-up

<html>
<head>
<body>
<iframe src="Example1.html"> </iframe>
</body>
</html>

Step2:

Example1.html  we have a button "Click Me", once the button is clicked, we have to redirect to url "www.google.com".

So we have to use window.top.location.href  to redirect parent window from an iframe action.

Html Mark-up - Example2.html

<script>
function changeurl()
{
window.top.location.href = "http://www.google.com";
}
</script>

<a href ="#"  id="accept" onclick="changeurl()"> Click Me </a>

Note: 

If your not using iframe tag, then u can use window.location.href to redirect parent window.

Step3:

Thanks for reading the article.Stay Tuned on www.webdesignersdairy.com  for more updates on Javascript.



Tuesday, May 14, 2019

How to iterate the Json array objects and nested objects using each function in jquery

Step1:

Welcome to  designer dairy blog, We are going to discuss to iterate the Json array objects and nested objects using each function in jquery

Step2:

Below is the example code for iterating the Json arry objects and nested objects


<html>
<head>
    <title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            // Creating a JSON object
            var employeeJSON = [
             {
                "firstName": "Todd",
                "lastName": "Grover",
                "gender": "Male",
                "salary": 50000

            },
    {
                "firstName": "Sara",
                "lastName": "Grover",
                "gender": "Male",
                "salary": 60000

            }]

var employeenestedJSON = {
             "todd": {
                "firstName": "Todd",
                "lastName": "Grover",
                "gender": "Male",
                "salary": 50000

            },
    "Sara": {
                "firstName": "Sara",
                "lastName": "Grover",
                "gender": "Male",
                "salary": 60000

            }
}


//{
//    "firstName": "Mary",
            //    "lastName": "Grover",
            //    "gender": "Male",
             //   "salary": 60000
//}];

            // Accessing data from a JSON object
            var result = '';

//$.each(employeeJSON, function(index, element)
//{
//result +=  index  + element + '<br/>';

//  result += '<br/>';
  //    result += 'First Name = ' + employeeJSON[index].firstName + '<br/>';
   //   result += 'Last Name = ' + employeeJSON[index].lastName + '<br/>';
           //   result += 'Gender = ' + employeeJSON[index].gender + '<br/>';
           //   result += 'Salary = ' + employeeJSON[index].salary + '<br/>';


//});

            
            var result = JSON.stringify(employeeJSON);
 
            var jsonstring = '[{"firstName":"Todd","lastName":"Grover","gender":"Male","salary":50000}]';
   
    var jsonobject = JSON.parse(jsonstring);


   
           var results = "";
           // object iteration
   
// $.each(jsonobject, function(index, item)
// {

//           results +=  index + ":" + item + "<br/>";

// });

// array object iteration
// $.each(jsonobject, function(index, item)
//{

//          results +=  "FirstName =" + jsonobject[index].firstName + "<br/>";
//   results +=  "LastName ="  + jsonobject[index].lastName + "<br/>";
//   results +=  "Gender ="  + jsonobject[index].gender + "<br/>";
//   results +=  "salary  =" + jsonobject[index].salary + "<br/>";

//});

// nested object iteration
console.log(employeenestedJSON);
$.each(employeenestedJSON, function(index, item)
{
       var fname = a["firstName"];
                       var gender = a["gender"];
  
    results +=  "First Name : " + a.firstName  + "<br/>"; 
results +=  "Last Name : " + a.lastName  + "<br/>"; 
results +=  "Gender : " + a.gender  + "<br/>"; 
results +=  "Salary : " + a.salary  + "<br/>";  
});


  $('#resultDiv').html(results);

        });
    </script>
</head>
<body style="font-family:Arial">
    <div id="resultDiv"></div>
<div id="resultDivz"> d</div>
</body>
</html>

Step3:

Thanks for reading my article.Stay Tune on www.webdesignersdairy.com  for more updates on Jquery.

Thursday, May 9, 2019

How to scroll up the page to the bottom using jquery

Step1:

Welcome to  designer dairy blog, here we are going to discuss how to scroll down the page to the bottom using jQuery.

Step2:

Html Mark-up

<div id ="heightdiv" style=" text-align:center; font-size:34px; color:#fff; height:1000px; background-color:red;">
click the window
</div>

Step3:

The following JavaScript will scroll the page to the bottom using jQuery:

<script>

$(document).ready(function()
{
  $('#heightdiv').bind("click", function () {

         var heights = $('#heightdiv').height();

         $('html, body').animate({ scrollTop: heights },"fast");
          return false;
           });

      });
   
     </script>

Otherway hard coding scroll top value :

$('#heightdiv').bind("click", function () {

$('html, body').animate({ scrollTop:3031 },"fast");

return false;


});

Step4:

Thanks for reading my article.Stay Tune on www.webdesignersdairy.com  for more updates on Jquery.



Friday, May 3, 2019

All in one roof - jQuery script


Step1:

Welcome to designer blog, We have added necessary JQuery functionalities, which is require to develop the web applications. 

Step2:

We have developed all the scripts under one roof called myScript.js

myScript.js:

var contractManagement = (function () {

function MaxHeights() {
if ($(window).width() <= 767) {


$("#left").css('height', 'auto');
$("#right").css('height', 'auto');

} else {
$("#left").height("");
$("#right").height("");

var MaxHeight = Math.max($("#left").height(), $("#right").height());
$("#left").height(MaxHeight);
$("#right").height(MaxHeight);
}
}


$(window).resize(function () {
MaxHeights();

});

function fileinput() {

$('#filecount').filestyle({
input: false,
buttonName: 'btn-add btn-sm',
iconName: 'glyphicon glyphicon-plus'
});
$("#filecount").change(function () {
MaxHeights();
});
}

function datetimepickers() {
$('.datetimepicker').datetimepicker({
format: 'DD/MM/YYYY'
});

}

function icheck() {
$('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
//Red color scheme for iCheck
$('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
checkboxClass: 'icheckbox_minimal-red',
radioClass: 'iradio_minimal-red'
});
//Flat red color scheme for iCheck
$('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
checkboxClass: 'icheckbox_flat-green',
radioClass: 'iradio_flat-green'
});
}

// Setup form validation on the #register-form element

function formValidation() {
$("#register-form").validate({

// Specify the validation rules
rules: {
customername: "required",
nextaction: "required",
email: {
required: true,
email: true
},

password: {
required: true,
minlength: 5
},
'test[]': {
required: true,
maxlength: 2
},
agree: "required",
duration: "required",

expanded: "required",
projecttype: "required"



},

// Specify the validation error messages
messages: {
customername: "Please enter your customer name",
nextaction: "Please enter next action ",
lastname: "Please enter your last name",
password: {
required: "Please provide your feedback",
minlength: "Your feedback must be at least 60 characters long"
},
contentarea: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
'test[]': {
required: "You must check at least 1 box",
maxlength: "Check no more than {0} boxes"
},
email: "Please enter a valid email address",
expanded: "Please enter expanded character attributes",
selected: "Select anyone field",
projecttype: "Please select the project type",
dates: "myselect",
duration: "Please enter your duration"

},

highlight: function (element) {
$(element).closest('.form-group').addClass('has-error');
$(element).closest('.datetimepicker').addClass('has-error');
},
unhighlight: function (element) {
$(element).closest('.form-group').removeClass('has-error');
$(element).closest('.datetimepicker').removeClass('has-error');
},

submitHandler: function (form) {
form.submit();
}


});

$('#register-form').on('submit', function () {
MaxHeights();
});
$('.clear').on('click', function () {
return false;
});

}

function datatables() {
$('#meeting-list').DataTable({

responsive: true,
"bLengthChange": false,
autoWidth: false,

"fnDrawCallback": function () {


$('th').each(function () {

if (($(this).hasClass('sorting')) || ($(this).hasClass('sorting_desc'))) {
$(this).attr({
title: 'Sort Ascending'
});


} else {
$(this).attr({
title: 'Sort Descending'
});
}
});
},

            initComplete: function () {
this.api().columns().every(function () {

var column = this;


if (column[0] != 5) {
var optionValues = [];

var list = $("").text();

 var select = $('<select onclick="event.stopPropagation()"><option value="">Choose</option></select>')
.appendTo($(column.header()).empty())

.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);

column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});

column.data().unique().sort().each(function (d, j) {

var divEle = $('<div />');
var objs = $(d).selector;
divEle.html(d);
divEle.find('i').remove();

optionValue = divEle.text().trim();




optionValues.push(optionValue);

});

optionValues.filter(function (item, pos) {

if (optionValues.indexOf(item) == pos) {
select.append($('<option>', {
value: item
}).text(item));
}

});

}


});
}


});

$('#meeting-list').on('responsive-resize', function (e, datatable, columns) {
var count = columns.reduce(function (a, b) {
return b === false ? a + 1 : a;
}, 0);
});
MaxHeights();
}

function selectcontrols() {
$("select option[value='']").each(function (index, item) {
if (index == 0) {
$(this).empty();
key = "Contract ID";
$(this).append($("<option></option>")
.attr("value", key)
.text(key));
}

if (index == 1) {
$(this).empty();
key = "Contract Type";
$(this).append($("<option></option>")
.attr("value", key)
.text(key));
}

if (index == 2) {
$(this).empty();
key = "Customer Name";
$(this).append($("<option></option>")
.attr("value", key)
.text(key));
}

if (index == 3) {
$(this).empty();
key = "Valid until";
$(this).append($("<option></option>")
.attr("value", key)
.text(key));
}

if (index == 4) {
$(this).empty();
key = "Signed On";
$(this).append($("<option></option>")
.attr("value", key)
.text(key));
}

if (index == 5) {
$(this).empty();
key = "View";
$(this).append($("<option></option>")
.attr("value", key)
.text(key));
}

});
}

function scrollbars() {
$('.content-scroll').mouseover(function () {
$('.content-scroll').removeAttr("style");
if ($('.content-scroll').height() > 609) {
$('.content-scroll').css({
"overflow-y": "scroll",
"height": "608px"
});
}
})
$('.content-scroll').mouseout(function () {

$('.content-scroll').removeAttr("style");
$('.content-scroll').css({
"overflow": "hidden",
"height": "608px"
});

})
}

function menuNavigation() {
$('.sidebar-menu li').on('click', function () {
$('.sidebar-menu li.active').removeClass('active');

$(this).first().addClass('active');
});
}

  function ScrolltoTop() {

   $('a[href^="#"]').not('[href=#]').click(function(e){
   var anchorTag=$(this).attr('href').replace('.','\\.');   
    $('html, body').animate({scrollTop: $(anchorTag).offset().top - ($('.searchbar').outerHeight()+5) },      1000);
     return false;
});

}

function ScrolltoBottom()
    {         
     var heights = $('#heightdiv').height();
       
      $('#heightdiv').bind("click", function () {
        $('html, body').animate({ scrollTop:heights },"fast");
        return false;
     });
    }

return {
MaxHeights: MaxHeights,
datetimepickers: datetimepickers,
icheck: icheck,
formValidation: formValidation,
fileinput: fileinput,
datatables: datatables,
selectcontrols: selectcontrols,
scrollbars: scrollbars,
menuNavigation: menuNavigation,
 ScrolltoTop :ScrollTop,
 ScrolltoBottom : ScrollBottom
};
})();


Step3:

To invoke the declare function in script.js. We have to call the script.js  and also make sure Html Dom is loaded.

<script>

$(window).on("load", function ()
{
     contractManagement.MaxHeights();
     contractManagement.scrollbars();
});

</script>

Step4:

Thanks for reading my article.Stay Tune on www.webdesignersdairy.com  for more updates on Jquery.

Validating to select in sequencial order using angular

    < input type = "checkbox" (change) = "handleSelectTaskItem($event, taskItem)" [checked] = " taskItem . i...