- Home
- Forum
- ASP.NET Core - EJ 2
- Dynamic create and selected the Tab after row selected in grid
Dynamic create and selected the Tab after row selected in grid
var totalItems = 0;
function rowSelected(arg) {
var content = document.getElementById('tab-content').value;
var ajax = new ej.base.Ajax('/Home/_StaffView?GUID='+ arg.data.EM_GUID, 'GET', true);
ajax.send().then();
ajax.onSuccess = function (data) {
var ctn2 = data;
// Required tab item object formed by using textbox inputs
var item = { header: { text: arg.data.EM_NAME }, content: ctn2 };
totalItems = document.querySelectorAll('#element .e-toolbar-item').length;
// Item object and the index argument passed into the addTab method to add a new tab
tabObj.addTab([item], totalItems-1);
}
};
var totalItems = 0;
function rowSelected(arg) {
var content = document.getElementById('tab-content').value;
var ajax = new ej.base.Ajax('/Home/_StaffView?GUID='+ arg.data.EM_GUID, 'GET', true);
ajax.send().then();
ajax.onSuccess = function (data) {
var ctn2 = data;
// Required tab item object formed by using textbox inputs
var item = { header: { text: arg.data.EM_NAME }, content: ctn2 };
totalItems = document.querySelectorAll('#element .e-toolbar-item').length;
// Item object and the index argument passed into the addTab method to add a new tab
tabObj.addTab([item], totalItems-1);
}
};
|
function onRowSelected(args) {
var selectedrecords = this.getSelectedRecords()
for (var i = 0; i < selectedrecords.length; i++) {
var title = selectedrecords[i].Employees;
var content = selectedrecords[i].Designation;
// Required tab item object formed by using textbox inputs
var item = { header: { text: title }, content: ej.base.createElement('pre', { innerHTML: content.replace(/\n/g, '<br>\n') }).outerHTML };
totalItems = document.querySelectorAll('#defaultTab .e-toolbar-item').length;
tabObj.addTab([item], totalItems);
tabObj.selectedItem = totalItems;
}
tabObj.refresh();
} |
- 1 Reply
- 2 Participants
-
KT Kenneth Tang
- Aug 20, 2019 03:08 PM UTC
- Aug 22, 2019 02:48 AM UTC