Newbie need sample code

Newbie need sample code

meghalvmeghalv Posts: 6Questions: 1Answers: 0

Could someone give sample file for creating table datatables. I am confused where to put the javascript code & do i really need server to test or could I just test it locally using html code?
It would be great if someone could post the project html sample file which used it.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    The simplest example has all the code you need to get started:
    https://datatables.net/examples/basic_init/zero_configuration.html

  • meghalvmeghalv Posts: 6Questions: 1Answers: 0
    edited April 2020

    I already tried it referring that but. does not work.. There is no html, head & body tag in example.
    I dont want bits & pieces of code.. I want a complete source code file sample.
    Where to place the javascript code in html. above table or below table. head tag or body tag.. or files... I have downloaded local copies of the css & js & added below 2 lines in head tag.
    <link rel="stylesheet" type="text/css" href="/datatables.css">
    <script type="text/javascript" charset="utf8" src="/datatables.js"></script>
    @tangerine Could you Please send me a working sample file so I can figure out what I am missing or doing wrong.

  • meghalvmeghalv Posts: 6Questions: 1Answers: 0

    Why cant these guys give a clear html file with full code sample for zero configuration. Not all who use datatables are pros. Why is everybody in all forums asking me to refer the same link for sample code.. It does not have a workable complete file. Just snippets of javascript & table is given... That does not help me ...

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    There is no html, head & body tag in example.

    So add them yourself, as appropriate for your environment and personal preferences.

    You should also read the installation instructions:
    https://datatables.net/manual/installation

    If you don't know how to construct a web page, this is not the place to start.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Here is a very basic example. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • meghalvmeghalv Posts: 6Questions: 1Answers: 0

    @colin Many thanks for the live example. This is exactly what I needed. Now following this example my code is working. How did you create your sample page at live.datatables.net ? Do you need any license or subscription to pro version or is it free for me to do some trial scripting. I dont know how to save any changes on it & send you new link, Could you share the link to some documentation around how to do it? I am curious to get my own online workspace... Please Please guide me bro...

  • meghalvmeghalv Posts: 6Questions: 1Answers: 0

    @tangerine Thanks for replying you my query & guiding me with your valuable time. I found my issue after looking at colins example. the *.js files were not loaded in my env correctly due to wrong path & missing js. Both of you are doing gr8 community service by helping people like me... Appreciate your inputs.

  • meghalvmeghalv Posts: 6Questions: 1Answers: 0
    edited April 2020

    @colin :smile: Now you gave me information on another gr8 feature of datatables which I found on this link after doing a bit of digging.. Please share other tools & features which would be handy & useful for me trying out datatables for my webpage.. I feel I have lots to learn from you ....

    Using JS Bin
    Actually using JS Bin is very simple; simply load http://live.datatables.net in your browser and start customising the HTML / Javascript / CSS as required. The buttons at the top of the browser window allow you to select what code is shown, and an option to see the final output.

    To share a created bin click the Share menu at the top of the browser window and copy the URL shown. Add that URL to your forum post, e-mail or otherwise share it and other developers will be able to review your example.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Do you need any license or subscription to pro version or is it free for me to do some trial scripting.

    It's free. I would suggest reading the manual and the reference pages, and look at the running examples. All the information you need will be there.

    Colin

This discussion has been closed.