Okay
  Public Ticket #1056698
Editable table
Closed

Comments

  •  6
    Alex started the conversation

    Hello

    MySQL table name - which table is specified here? I'm doing a query from a table Woocommerce. I specify this - wp_woocommerce_order_items?

  •  1,846
    Miloš replied

    Hi Alex,
    Thank you for your purchase.

    Do you mean MySQL table name for editing ?
    If it is, you enter there the name of the table where are you getting the data FROM.
    In your case i think it is wp_woocommerce_order_items.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  6
    Alex replied

    If I start to edit a table, it hangs.

    My query:

    select * from (

    SELECT posts.ID as order_id, posts.post_date

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Страхователь' ) as strach

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Наименование') as naim

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Инн') as inn

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Фамилия Страхователя (по-русски)') as fs

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Имя Страхователя (по-русски)') as ist

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Отчество Страхователя (по-русски)') as ots

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дата рождения Страхователя') as drs

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Пол Страхователя') as pols

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Гражданство Страхователя') as grs

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Фамилия Застрахованного (по-русски)') as fz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Имя Застрахованного (по-русски)') as iz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Отчество Застрахованного (по-русски)') as oz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дата рождения Застрахованного') as drz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Пол') as polz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Гражданство') as grz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Паспорт, серия') as ps

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Номер') as pn

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дата выдачи') as dv

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Кем выдан') as kv

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дата регистрации') as dregs

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Паспорт, серия Застрахованного') as psz

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Номер паспорта Застрахованного') as npza

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дата выдачи паспорта Застрахованного') as dvpza

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Кем выдан паспорт Застрахованного') as kvpza

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Индекс' ) as ind

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Город' ) as gorod

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Улица' ) as street

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дом' ) as house

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Кв.' ) as flat

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Телефон' ) as phone

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Город Застрахованного') as gorzas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Улица Застрахованного') as ulzas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дом Застрахованного' ) as dzas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Строение Застрахованного') as strzas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Корп. Застрахованного') as korpas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Кв. Застрахованного') as kvzas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Телефон Застрахованного') as telzas

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Номер полиса') as polis

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = '_Дата оформления' ) as dataof

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Дата начала договора') as datana

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Страховая сумма, руб.') as ss

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'СТРАХОВАЯ ПРЕМИЯ, РУБ.') as sp

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Застрахованный и Страхователь - одно лицо' ) as da

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = '_Агент' ) as agent

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'СТРАХОВАЯ ПРЕМИЯ, РУБ.' ) as srok

          ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Наименование агента' ) as naimagent

           ,(select oim.meta_value  from wp_woocommerce_order_itemmeta as oim

             where oim.order_item_id = woi.order_item_id

            and oim.meta_key = 'Размер АВ' ) as komiss

     
           FROM wp_posts as posts,

                wp_woocommerce_order_items as woi

          where  woi.order_id = posts.ID

           and   posts.post_type = 'shop_order'

           and posts.post_status = 'wc-on-hold' ) f

           Where (f.agent = 'Rosmed' or f.agent = 'Rosmed2') and f.post_date > '2017.01.01'


  •  6
    Alex replied

    Hi

    I receive "unknown column "Naimenovanie" in field list" after online-edit field

    Mysql query:

    select lead_id,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 34 ) Страхователь,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 37 ) Наименование,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 36 ) ИНН,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 6 ) Фамилия,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 4 ) Имя,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 8 ) Отчество,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 32 ) Номер,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 77 ) Стоимость

    from wp_rg_lead_detail l
    WHERE form_id = '17'
    group by lead_id


  •  1,846
    Miloš replied

    Hi Alex,

    Did you try to run query directly in phpMyAdmin? When you perform this query in phpMyAdmin or any other Database management system do you get data that you want to get also in wpDataTables plugin? If you are not getting desired data then problem is obviously related with MySQL query itself.

    If you used wpDataTables constructor to generate this query you have to know that wpDataTables constructor  is not an ‘ultimate generator’, it should be consider a helper that constructs a suggestion of a query trying to ‘guess’ what you want. 

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  6
    Alex replied

    I made a request to phpMyAdmin, see screenshot

    The same data I get in the plugin

  •  1,846
    Miloš replied

    Hi Alex,

    If that is the case you will have to adapt and change the query so you would get the data that you wish. After you get right data in phpMyAdmin you'll get same data also in wpDataTable. 

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  6
    Alex replied

    In phpMyAdmin i receive -

    This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.

    ???

  •  6
    Alex replied

    This query works in MyphpAdmin, but in wpdatatables i receive error - "unknown column "strah" in field list" after online-edit field

    select id, lead_id,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 34 ) strah,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 6 ) fam,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 4 ) imya,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 8 ) otc,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 32 ) nomer,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 77 ) stoim

    from wp_rg_lead_detail l
    WHERE form_id = '17'
    group by lead_id

  •  1,846
    Miloš replied

    Hi Alex,

    Table based on such a query unfortunately cannot be made editable. Please see the limitations list highlighted in our documentation regarding the front-end editing: http://wpdatatables.com/documentation/front-end-editing/limitations-of-table-editing/

    I'm afraid if you would like to edit this table through wpDataTables you would need to save the results of this query in a separate MySQL table.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  6
    Alex replied

    What is the limitation in my query?

    • Only one MySQL table can be edited at a time. Queries from multiple tables with joins cannot be used for editable feature, since SQL UPDATE and INSERT statements are generated automatically, and for now there is no way to update multiple tables – but we are working on this.
    • Only MySQL tables or tables created with first 2 options of Table Constructor can be edited – I know this is kind of obvious, but after a number of requests I had to put this here as well.
    • Server-side processing MUST be turned on for front-end editing – but it will turn on automatically if you forget to enable it.
    • MySQL views cannot be edited properly – only one of the underlying tables can in case you pass the proper ID.


  •  1,846
    Miloš replied

    Hi Alex,

    Sorry for late response.
    The limitation in your query is select in select (in your example select id, lead_id,
    (select value from wp_rg_lead_detail f where f.lead_id = l.lead_id and f.field_number = 34 ) strah, ) which will refer to the first limitation- Queries from multiple tables can not be edited.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables