How do I use Generator Knex outside of Datatables

How do I use Generator Knex outside of Datatables

andrew beeverandrew beever Posts: 12Questions: 6Answers: 0

I am very very new to the world of website development / Datatables so apologies in advance for the basic question.

I have hacked several Datatables Generator files together and everything works fine.

Two questions

  1. My question is how can I re-use Knex to retrieve data for other use by other elements on my site.

  2. Instead of using the 'Always visible editing panel' can I use a form to emulate the 'Create' process.

Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin
    Answer ✓

    My question is how can I re-use Knex to retrieve data for other use by other elements on my site.

    Assuming you are constructing the Knex setup like this then whatever variable you import / require that file into would have a Knex object, so you would use it just as you would with any other Knex instance.

    Instead of using the 'Always visible editing panel' can I use a form to emulate the 'Create' process.

    Probably - but it isn't something that I've tried myself, since any changes you make at the Editor level would need to be replicated in your custom form. If you do try this approach, structure the form so that it sends data to the server using the format Editor expects. Also keep in mind that our libraries were designed for use with a JSON data return - so you might need a custom controller. At that point, it would be easier just using a simple from to be honest!

    Allan

This discussion has been closed.