0

I am creating a website in MVC5 using bootstrap with the boostrap tables library http://wenzhixin.net.cn/p/bootstrap-table/docs/index.html using:

$('#subscriber-table').on("click-row.bs.table", function (e, row, $element) {
                        console.log(row.SubscriberID);
                        $('#subscriberDialog').modal();
                    });

I receive the click on one of the table's records. This works great ony now I want to pass the json object called row to my created modal, so I can set the name input field. Like this:

$('#subscriberDialog').on('show.bs.modal', function (event) {

     $('#namefield').val('toSetName');
});

I have been trying to figure this out but I cant seem to get it to work.

2 Answers 2

2

What you can do you can set any custom attribute in modal to get the value.

like this :

$('#subscriber-table').on("click-row.bs.table", function (e, row, $element) {
  console.log(row.SubscriberID);
  $('#subscriberDialog').attr('data-custom-value', 'toSetName');
  $('#subscriberDialog').modal();
});


$('#subscriberDialog').on('show.bs.modal', function (event) {
     var val = $(this).attr('data-custom-value');
     $('#namefield').val(val);
});

Sign up to request clarification or add additional context in comments.

Comments

0

Pass Through array also like OnClick(['a','b','c']);

and Retrieve Like function checkData(value) { alert(value[0] + " " + value[2] .....); }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.