Spell storing is a Magic Weapon Special Ability which can only be placed on melee weapons:
A spell storing weapon allows a spellcaster to store a single targeted spell of up to 3rd level in the weapon. (The spell must have a casting time of 1 standard action.) Anytime the weapon strikes a creature and the creature takes damage from it, the weapon can immediately cast the spell on that creature as a free action if the wielder desires. (This special ability is an exception to the general rule that casting a spell from an item takes at least as long as casting that spell normally.) Once the spell has been cast from the weapon, a spellcaster can cast any other targeted spell of up to 3rd level into it. The weapon magically imparts to the wielder the name of the spell currently stored within it. A randomly rolled spell storing weapon has a 50% chance of having a spell stored in it already. This special ability can only be placed on melee weapons.
source emphasis mine
Some melee weapon can be thrown:
Melee weapons are used for making melee attacks, though some of them can be thrown as well. Ranged weapons are thrown weapons or projectile weapons that are not effective in melee.
source emphasis mine
A dagger is a melee weapon. So I can have a spell storing dagger. A dagger can be thrown.
So my 5th level 14-strength magus throws my throw-able spell storing dagger stored with a Shocking Grasp. The attack passes. Does the spell cast? The dagger deals 1d4 piercing + 2 from str + 5d6 electricity, doesn't it?
Edit following comments
Anytime the weapon strikes a creature and the creature takes damage from it, the weapon can immediately cast the spell on that creature as a free action if the wielder desires.
What is the wielder? The problem is that "wield" is used as just a word and not a game term. Their no official ruling nor FAQ about that (as per a discussion shared by @Hey I Can Chan)
In our case, does the character is still wielding after the weapon is thrown? While I have the weapon in hand, can I chose to activate the spell on damage?