Child table's button type only appears on click of table

Hi Guys

i have created on child table there is two fields one name as data type and other one is view as button type so when i do refresh the child table button is disappearing

and whenever i clicked on child table suddenly button appears


does any one know what is the issue here

thanks and regards
Eliyas

1 Like

I was wondering the same as I’m facing the same issue. Any idea on how to fix button and make it visible with no need of clicking on the row?

@Bradley @eliyaskhan18 have you found solution or any work around

1 Like

U can show button by using jquery

refresh(frm) {

frm.fields_dict["field_name"].$wrapper.find('.grid-body .rows').find(".grid-row").each(function (i, item) {

    $(item).find('[data-fieldname="field_name"]').empty().append("<button class='btn btn-xs btn-success'>Finish</button>").click(function () {

        let cdn = $(item).attr('data-name')

        let cdt = frm.fields_dict["field_name"].grid.doctype

        frm.script_manager.trigger('field_name', cdt, cdn)

    })

});

};

2 Likes

Hello @abrarpv97 did you found any solution?

@Thiago_Henry yes,

  1. i have created new data field ‘action_button’ as readonly in child table

  2. In refresh function i am changing field type to button using below script

     let btn_class;
     let status;
     let html_tag;
     let html_attribute;
     let button_label = 'Select'
     frm.fields_dict[child_table_fieldname].$wrapper.find('.grid-body .rows').find(".grid-row").each(function (i, item) {
     btn_class = 'btn btn-primary';
     html_tag = 'input';
     html_attribute = 'type="button"';
      $(item).find('[data-fieldname="action_button"]').replaceWith('<'+ html_tag +' class="col col-xs-1 ' + btn_class + '"' +
     				'data-fieldname="action_button" data-fieldtype="Data" ' + html_attribute +
     				' value="'+ button_label +'" style="margin: 2px;">' +
     				'</div><div class="static-area ellipsis"></div></' + html_tag + '>');
    

    });

3 Likes

Got it, thanks a lot @abrarpv97