• Resolved veerkun

    (@veerkun)


    Current plugin will show all column in list records page (admin.php?page=simple_table_manager_list).
    If you have free time, please write code with 2 new feature:
    + Select column show in List Records page: After select table name in Settings page, will add 1 admin page settings for select list column will show in List Records page.
    + Add view single record page: Show single record details with key : value

    thanks you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Majeed Raza

    (@lorro)

    So we can see only some of the columns, not all of them? That would be good because sometimes all the columns won’t fit on the screen. I will do that.

    Single record page – that’s the same as the edit record page, except read-only? I am not sure that would be useful.

    Thread Starter veerkun

    (@veerkun)

    thanks you for your reply. If have free time, please complete idea #1.
    ——————————-
    I have some idea for you can develop in future

    1. Please hide fields in add new record if this field is AUTO_INCREMENT (current plugin will use MAX(value) + 1)
    2. Another Idea, you can code for user can create multi admin menu page for database table. Example, i have 2 custom table: wp_customers and wp_contact. I need manager customers and orders same time, this plugins will help me create multi admin page:
    +. Customers (parent menu)
    — List customers (sub-menu) ( can control list columns will show)
    — Addnew customer (sub-menu)
    +. Contact (parent menu)
    — List contact (sub-menu) ( can control list columns will show)
    — Addnew contact (sub-menu)
    After create menu and reload page, menu had just created will appears in wordpress admin menu.
    —————–
    3. And if you can, in next version, please use apply_filters for custom table column.
    Example: i have custom table wp_customers have column is_enable with value 1|0 store in database
    + In page list customers, please return a hook (don’t print raw value) for developer can customize in theme.

    $value = apply_filters( 'customers_list_column', $column_name, $column_value );
    return $value;

    Developer can use custom code for show Yes|No value like

    add_filter( 'customers_list_column_is_enable',  function($column_name, $column_value)
    {
        if($column_name === 'is_enable')
        {
            if($column_value === '1')
            {
                return 'Yes';
            }
            return 'No';
        }
        return $column_value;
    });
    

    + the same for page addnew||edit customer: i want use checkbox for this column, please return

    $form_field_html = apply_filters( 'customers_edit_column', $form_field_html, $column_name, $column_value);
     return $form_field_html;

    Developer can use custom code for change textbox to checkbox like

    add_filter( 'customers_edit_column',  function($form_field_html, $column_name, $column_value)
    {
    if($column_name === 'is_enable') 
    {
      $checked =  checked( $column_value, 1 );
        $form_field_html = '<input type="checkbox" name="'. $column_name .'" value="1" ' . $checked  . '>';
    }
       return $form_field_html;
    });

    Sorry my english is not good, hope you will understand my idea.
    thanks.

    • This reply was modified 3 years, 10 months ago by veerkun.
    • This reply was modified 3 years, 10 months ago by veerkun.
    • This reply was modified 3 years, 10 months ago by veerkun.
    Plugin Author Majeed Raza

    (@lorro)

    Q) Ability to hide user-selected table columns.
    A) Good idea, thank you. The latest version implements this. Especially good for the wp_posts table which is very wide if all its columns are shown in a table.

    Q) Hide auto-increment field in add-new-record
    A) add-new-record can’t hide the primary key field if its not auto-increment or if its not an integer type, and I think it would be confusing to hide it sometimes and not others, so I have not implemented this.

    Q) Linked tables
    A) Difficult to do for the general case which this plugin tries to serve. Would complicate the user interface. Outside the scope of this plugin. You will need some custom code for your application. You are free to fork the plugin, just give it a new name.

    Q) Filter field html
    A) Implemented in latest version. Filters pass table_name and key_value as well so the user’s filter function can better identify the fields to target. The filters will not work with check boxes. This is because an unchecked checkbox does not return a field-value pair in $_GET. Yes, it can be done in custom code because the save function can interpret the absence of a particular field-value pair, but its not safe to do so in the general case. The filters should work with radios, selects, textareas and for dates and times if the field is a text field.

    Q) Filter List column value
    A) Implemented in latest version.

    Q) Documentation
    A) See the Installation tab for filter use examples.

    Plugin Author Majeed Raza

    (@lorro)

    I found out how to use a checkbox in the filter. You would write something like this in your filter function:

    $checked = $field_value ? 'checked' : '';
    $field_html = '<input type="hidden" name="'.$column_name.'" value="0">';
    $field_html .= '<input type="checkbox" name="'.$column_name.'" value="1" '.$checked.'>';
    

    So if the checkbox is not checked, it doesn’t return anything, but the hidden input returns $name = 0.
    If the checkbox is checked, the hidden value is overwritten and the form returns $name = 1.

    This way, the form handler doesn’t need to know whether or not a field is a checkbox.

    Plugin Author Majeed Raza

    (@lorro)

    I think that this issue is resolved. If you would like to post further, please start a new thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Select column will show in List Records’ is closed to new replies.