jQuery syntax run function selector child element parent element event

jQuery syntax run function selector child element parent element event

I wanted to hide a child element on its parent’s element event, more specifically I had a DIV containing an ‘h4’ element, and I wanted to hide my ‘h4’ element when the ‘onmouseover’ event occurs on my DIV, using the jQuery slide toggle effect.

jQuery syntax run function selector child element parent element event

jQuery

The jQuery.com site did not show an example of how to get this done, so I looked and found this great forum thread on StackOverFlow.


So here’s a simple demo of how to use this syntax –
Here my html –
{code type=Html}

my Test

{/code}
And here’s my code (make sure you have an updated jQuery reference) –
{code type=JavaScript}

$(‘.DivClass’).hover(function () {
$(“h4”,this).slideToggle(“slow”);
},
function () {
$(“h4”,this).slideToggle(“fast”);
})
{/code}


And here’s the demo in work:

my Test

An here’s a link to JSfiddle where you can see a few more examples of this code.

Sort SharePoint lookup column Dropdown by customizing your list form with InfoPath

Sort SharePoint lookup column Dropdown customizing list form InfoPath

This is a quick solution to a very common issue in SharePoint:

When we create a lookup column in a SharePoint list it is automatically sorted by the alphabetic values of our lookup column in ascending order, regardless of the items id or their created date, and we don’t have an out of the box choice in this matter.


The solution – simply modify your list form with InfoPath, its quick and easy, and here how:

  1. I’ve created a lookup column to a list of fruits, and here’s how my lookup dropdown looks (as you can see it is sorted alphabetically in ascending order):
lookup column sorted by id

lookup column sorted by id

  1. So first thing first I’ll add an order column for my Fruits list and I’ll set their order values by their sizes (more or less..)
lookup list items

lookup list items

  1. Now I’ll go back to my Orders list and customize it’s form using InfoPath:
Customize with InfoPath ribbon button

Customize with InfoPath ribbon button

  1. In InfoPath go to the Data tab on the ribbon and then click on the Data Connections button:
InfoPath dataconnections button

InfoPath dataconnections button

  1. You should now see that your form has already 2 data connections – a main data connection and a secondary data connection to your lookup list:
Data Connection window

Data Connection window

  1. Now simply add a new data connection to your lookup list, clicking on the “Add..” button will open this window:
Create a new Data Connection

Create a new Data Connection

  1. We need the default option of “Create a new connection to: Receive Data” so simply click next, and on the next window chose to receive your data from a SharePoint library or list and click next:
Data connection wizard

Data connection wizard

  1. The next window should automatically show your site’s address so simply click next:
Data Connection wizard screen

Data Connection wizard screen

  1. Now Choose your lookup list from the list of lists under your site and click (Although you already have a data connection to this list on your form we can’t modify it, so we need to create a new one and then we can control it’s sorting)  –
Connection to list

Connection to list

  1. This is the important part, check the checkbox next to the column you need to show in your lookup combo box (In my example it’s the Title column) and also check the one next to your “Order” column, then in the drop down at the bottom of this window choose to “Sort By:” the Order column, and choose the sort order to be ascending or descending according to your need:
Choose columns

Choose columns

  1. Now click Next -> Next -> Finish, If you’d like you can change the name of your new data connection before clicking the finish button, on the last screen of the adding data connection wizard.
Data connection wizard finish screen

Data connection wizard finish screen

  1. Now go to lookup Combo Box on your form, right click it and choose “Drop-Down List Properties” from the bottom of your field menu:
Dropdown list box properties

Dropdown list box properties

  1. Now replace your dropdown list data source to the new data connection you’ve created –
Change datasource

Change datasource

  1. Change your value column to “ID” –
Change value column

Change value column

 15. Click OK –

  1. Now just publish your form, first save it on your computer and then click on file -> publish -> SharePoint List
Publish your form

Publish your form

  1. That’s it! Now your lookup dropdown will be sorted by your order column –
Now its sorted

Now its sorted