• Resolved kentauron

    (@kentauron)


    Hi,

    when ‘default_values’ param is defined, field values flush immediately after edited, as soon as cursor moves to another field

    ex: ‘default_values’=>’Array(“supp_code”=>”abc”)’,

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author bobbysmith007

    (@bobbysmith007)

    hrmm… I havent experienced that particularly. I just tested it on a local instance with the latest version and I was able to set default_values that worked.

    I did notice a weirdness. Usually as soon as you edit the “new” row, it will fill in all the default values at once. However if you edit the column with a default value in it first. It replaces the value typed in with the default value. I didn’t see it clearing anything, but maybe its related. Anyway, thank you for your comment as it uncovered a bug.

    Cheers,
    Russ

    Thread Starter kentauron

    (@kentauron)

    Maybe the real issue is that a new row is not created, so what edited flushes away

    Plugin Author bobbysmith007

    (@bobbysmith007)

    So when you type into the “new row” at the end of the page, it immediately adds a new “new-row” just below it. That is so you could add multiple rows at once (not super recommended anyway, but… ). This shouldn’t disrupt the original new row you were editing. Perhaps, that older new-row is resorted weird?

    Thread Starter kentauron

    (@kentauron)

    When ‘default_values’ is set no new row is created when you start to edit the last blank row

    Thread Starter kentauron

    (@kentauron)

    Anyway for on of my needs (add the current username to a field) I added a new argument to the plugin code: $current_user_column (on class DBTableEditor)
    and after the no_edit_cols check “if($no_edit_cols){“, the following code to add the current username in that hidden field:

    $current_user = $cur->current_user_column;
    if(is_string($current_user)) $current_user=explode(‘,’,$current_user);
    if($current_user){
    foreach($current_user as $c_user){
    $wp_current_user = wp_get_current_user();
    $up[$c_user] = $wp_current_user->display_name;
    }
    }

    • This reply was modified 5 years, 8 months ago by kentauron.
    Thread Starter kentauron

    (@kentauron)

    There was an error in writing the arg, no bug.
    ‘default_values’ arg works fine

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Thanks for updating this issue, glad you got it fixed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘‘default_values’ not working’ is closed to new replies.