The Prophet said [peace and blessing of Allah be upon him]
"There was Allah and nothing else before Him and His Throne was over the water, and He then created the Heavens and the Earth and wrote everything in the Book [Bukhari :: Book 9 :: Volume 93 :: Hadith 514]
Here Allah messenger [peace and blessing off Allah be upon him] says, [There was Allah and nothing else before] this is to show us that nothing existed or nothing was with Allah and He created everything that exist even His throne as Allah have said after He created the heavens and earth, (and then established Himself above the Throne) and what we can understand here is that Allah created His Throne first and then created water just like Allah messenger ***[peace and blessing off Allah be upon him] says, [and His Throne was over the water] and that water would be created from all creation and that His Throne is above the water for a reason which all off His creation would be created from especially mankind therefore, all the creation off Allah are all under His Throne and nothing is above Allah but rather every one off His creation are under His chair Allah says, (His Chair [Kursi] extends over the heavens and the earth) [2-255] Ibn
Abbas said, "Kursi is the footstool, and no one is able to give due consideration to Allah Throne” Further IbnAbbas said, If the seven heavens and the seven earths were flattened and laid side by side, they would add up to the size of a ring in a desert, compared to the Kursi. What we can understand here is that Allah Has a Throne and a Chair and that He is above the Throne while His Chair is under His throne and that Allah uses the Chair as a footstool and that all His creation are under His Chair that He uses as a footstool and out off all His creation nothing is above the Throne except Allah and the reason why Allah uses the chair for as a footstool it is because there is nothing like Allah nor is there anyone who is equal to Him therefore, Allah can not use a chair which His creatures use to sit on as a comfort nor can He call His Throne a chair and out of all His creation whether be in the heavens or in paradise there is nothing that is equal to His Throne in beauty and as a creation that is why Allah is called The Lord of the Great Throne. After Allah created the creation off the heavens and earth just like Allah messenger [peace and blessing off Allah be upon him] have said here, [and He then created the Heavens and the Earth] this shows us that after the creation off the Throne, water and the Chair then Allah created the heavens and earth and then wrote down everything that will occupy in the earth and the heavens and there way off living that is why Allah messenger [peace and blessing off Allah be upon him] have said, [and wrote everything in the Book] also Allah says, (And among His signs is the creation of the heavens and the earth, and whatever moving (living) creatures He has dispersed in them both)* [42-29] thus, this shows the heavens and earth were created for the purpose of the living creatures to occupy in them only therefore, It is compulsory upon every Muslim to believe this as it is Allah Whom gave as this description through His messenger [peace and blessing off Allah be upon him] which He revealed to him through His Book and also his tradition.
This is the ability of Allah that He knew everything that would happen in His creation before He created all the creation, and it would not make sense to say Allah did not knew what He created what they would do to begin with He is the who created them, also the free will is there too and Allah gave you a choice and He knew which path you would take, therefore, Allah Has writing only according our free will and the choices we have made and this is what is meant predestination or Qadar.