Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3744

Iterate MJoin options and show text box with labels

$
0
0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: Hi
I have an MJoin as per https://datatables.net/forums/discussion/62907 which displays options. I need to show these as labels with a text box so users can enter a quantity value.Here's the MJoin:

                editor.MJoin(new MJoin("DDIs")
                    .Model<SubsPacksDBModel.DDIs>()
                    .Name("GlobalPacksDDIs")
                    .Link("GlobalSubsPacks.id", "GlobalSubsPacksRelations.SubPackID")
                    .Link("DDIs.id", "GlobalSubsPacksRelations.ParamID")
                    .Where(q =>
                        q.Where("GlobalSubsPacksRelations.ParamType", "3", "=")
                    )
                    .Order("DDIs.id ASC")
                    .Field(new Field("id")
                        .Options(new Options()
                            .Table("DDIs")
                            .Value("id")
                            .Label(new[] { "DdiNumber", "Description" })
                        )
                    )
                );
                    }, {
                        label: '',
                        name: 'GlobalPacksDDIs[].id',
                        type: 'text',
                        data: function (row, type, val) {

                            if (IsNullOrEmpty2(row.GlobalPacksDDIs.Description))
                            {
                                return row.GlobalPacksDDIs.DdiNumber;
                            }
                            else
                            {
                                return row.GlobalPacksDDIs.DdiNumber + ' (' + row.GlobalPacksDDIs.Description + ')';
                            }
                        }
                    }

If I choose a checkbox the boxes show but nothing shows if I specify field type 'text' (with the if else statement commented out). I need to show the DdiNumber and Description together as per the if else statement if the Description is non null. Thanks.


Viewing all articles
Browse latest Browse all 3744

Trending Articles