Get Start
*********
In this example, we go step by step to setup and run simple example by basis core.
.. note::
For create this example access to internet needed for get some *js* file.
At first create new file and name it *test.html*.
Open file in your favorite text editor and add this bellow content to it:
.. code-block:: html
:linenos:
Test
Test
Now add link to :download:`basiscore.min.js ` and :download:`alasql.min.js ` to bellow of created document.
This file add *BasisCore* client side processing and rendering engine, and setup :doc:`host/context-object` when document load in browser.
.. tip::
You can download this two file, save and use locally in offline mode, without use of BasisCore cdn servers.
.. code-block:: html
:linenos:
Test
Test
In the next step, add a simple :doc:`commands/source/dbsource` command to document.
:class:`dbsource` is a one :doc:`commands/source/source`.
For more information about commands, see :doc:`commands/commands`:
.. code-block:: html
:linenos:
Test
Test
Now must add setting to document for determine config for connection to servers.
For more information bout setting client side, see :doc:`host/client`.
This setting add as a json object like bellow:
.. code-block:: html
:linenos:
Test
Test
As you can see in above, in host setting, value :class:`http://185.44.36.122:8080` set form :class:`basiscore` attribute in :class:`Settings`.
Now :class:`source` attribute of :doc:`commands/source/source` can use :class:`basiscore` as value to find out information about how to connect to data provider.
Now in :class:`member`tag of :class:`dbsource` command, add :class:`preview` with value :class:`true`.
Then save document and open it in browser.
.. code-block:: html
:linenos:
Test
Test
Render result in browser.
.. image:: /_static/0001.jpg
Now add a simple :doc:`commands/renderable/print` command.
:class:`print` is a one :doc:`commands/renderable/renderable`.
Also remove :class:`preview` attribute added in previous step.
.. code-block:: html
:linenos:
Test
Test
@title
And result in browser:
.. image:: /_static/0002.jpg
Use Data In Javascript
======================
One Important feature of :class:`host/context-object` is communication with javascript easily.
In some scenario, it is important that access to loaded data from :doc:`commands/source/source`.
Now let add some javascript to document to show way of communication between BasisCore command and javascript code.
.. code-block:: html
:linenos:
Test
Test
For simplicity, remove :class:`print` command.
As you can see, in bottom of document, we add a :class:`script` tag and in it
, use :class:`WaitToGetDataSourceAsync()` method to add wait call-back handler.
In handler we simply print data source in console window using :class:`console.table()` method.
Save and load document in browser.
If move to console window, see this:
.. image:: /_static/0003.jpg