EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Steve2106 on November 08, 2019, 03:10:05 PM



Title: Getting error on message
Post by: Steve2106 on November 08, 2019, 03:10:05 PM
Hi There,

I am deleting a record and when I get a message asking am I sure I want to delete there is an odd [object] [object] at the end of the text. (please see attachment)

This is the code calling the messageBox:
    function destroyCert(){
        var row = $('#dg').datagrid('getSelected');
        if (row){
            $.messager.confirm('Confirm','Are you sure you want to delete this certificate?' + row,function(r){
                if (r){
                    $.post('destroy_cert.php',{id:row.id},function(result){
                        if (result.success){
                            $('#dg').datagrid('reload');   // reload the user data
                        } else {
                            $.messager.show({   // show error message
                                title: 'Error',
                                msg: result.errorMsg
                            });
                        }
                    },'json');
                }
            });
        }
    }

Thanks for your help.

Best Regards,

Steve.


Title: Re: Getting error on message
Post by: jahangir on November 08, 2019, 09:47:06 PM

$('#dg').datagrid('getSelected') returns the data in JSON format, you should spacyfiy the field name that you want to show in message.
Code:
$.messager.confirm('Confirm','Are you sure you want to delete this certificate?' + row.yourfiedname ,function(r){


Title: Re: Getting error on message
Post by: Steve2106 on November 09, 2019, 03:24:00 AM
Hi Jahangir,

Thanks for your reply. All working now.

Best Regards,

Steve.