Is it possible to populate a select list from SQL table outside of the datatables/Editor?

Is it possible to populate a select list from SQL table outside of the datatables/Editor?

bensdbbensdb Posts: 30Questions: 4Answers: 0
edited May 2014 in General

I've got a datatable up and running with Editor.

Works Great.

I then have a custom filter that I have built, with two selects, that sit outside the datatable. Can I populate it from an SQL table, without having to make another SQL connection within a php script? Obviously Editor has already established a connection, but I don't know how to link into its functionality for this purpose....

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    You can make use of the Editor Database library to do this kind of thing. There is an example in the Editor join examples and the database class documentation is available here.

    Allan

  • bensdbbensdb Posts: 30Questions: 4Answers: 0
    edited May 2014

    OK struggled with this for a while but my complete lack of knowledge is frustrating me.

    Can I use the json data from this bit of code that populates selects on my editor form, to populate the select called 'testselect', for which I have added in some inital code at the bottom?

    SOOO confused

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Sure - I don't see why not :-). The initCallback function provides access to the JSON if you want it to manipulate the page.

    Allan

  • bensdbbensdb Posts: 30Questions: 4Answers: 0

    CANNOT figure this out with my severely limited lack of knowledge. Been trying for two days!!!!

    Could someone just give me a working example pleeeeaase?

    I'm trying to populate a select called 'testselect' in the navigation section of my page- so is not part of my datatable headers etc, with values from the first column of a table called 'groups', with column name 'group_names'.

    Don't know what I'm doing and am going round in circles trying to figure it out.

    An identical select is populated by my editor form, so the process is there, I just don;t know how to do this

  • bensdbbensdb Posts: 30Questions: 4Answers: 0

    Anyone?

This discussion has been closed.