javascript - open jQuery UI dialog in front of edit/add dialog jqGrid -
i costomize edit-/add-dialog jqgrid. in "beforeshowform" event add buttons , fields. after pressing button there jqui dialog. can achieve opening of new jquery ui dialog, opens behind edit-/add-dialog jqgrid. how can make opening in front of edit-/add-dialog jqgrid?
this code:
var gridwidth = 1000, gridheight = 600; var pagersettings = { add: true, addtext: "Добавить", edit: true, edittext: "Редактировать", del: true, deltext: "Удалить", search: false, refresh: false }; var editsettings = { closeafteredit: true, }; var addsettings = { closeafteradd: true, closeonescape: true }; var searchsettings = deletesettings = { closeonescape: true }; function customform(form) { addselector(form); addbuttons(form); }; function addselector(form) { var namecolumnfield = $('#tr_weburi', form).show(); var tr = $('<tr />', { class: "formdata", id: "tr_activitiesid" }); var td_row_one = $('<td />', { class: "captiontd" }).appendto(tr); var td_row_two = $('<td />', { class: "datatd" }).appendto(tr); var sel = $('<select />', { id: "activitiesid", multiple: "multiple" }).appendto(td_row_two); tr.insertafter(namecolumnfield); $("#activitiesid").multiselect({ autoopen: false }).multiselectfilter(); }; function addbuttons(form) { var arr = [ { id: "citiesid", text: "cправочник населенных пунктов" }, { id: "activitiesid", text: "cправочник видов деятельности" } ]; $.each(arr, function (i, val) { var namecolumnfield = $('#tr_' + val.id, form).show(); var tr = $('<tr />', { class: "formdata", id: "tr_" + val.id + "button" }); var td_row_one = $('<td />', { class: "captiontd" }).appendto(tr); var td_row_two = $('<td />', { class: "datatd" }).appendto(tr); $('<div />', { id: val.id + "dialog", title: val.text }).appendto($('body:first')); $('<button />', { id: val.id + "button", text: val.text }).button().click(function () { $("#" + val.id + "dialog").dialog({ modal: true, buttons: { ok: function () { $(this).dialog("close"); } } }).css('zindex', 1000); }).appendto(td_row_two); tr.insertafter(namecolumnfield); }); }; // Основная таблица: $('#objectsmap').jqgrid({ type: "get", datatype: "json", url: "/map/getorganizations", editurl: "/map/editorganizations", colnames: new array('id', 'Наименование*', 'Номер', 'Адрес*', 'Населенный пункт', 'Телефон', 'Сайт', 'Дополнительно'), colmodel: new array( { name: 'id', key: true, width: 50 }, { name: 'name', editable: true, editrules: { required: true } }, { name: 'number', editable: true, formoptions: { elmsuffix: $('<p />').text('номер по реестру, код таможенного органа').css('margin', '2px 5px') } }, { name: 'address', editable: true, editrules: { required: true }, formoptions: { elmsuffix: $('<p />').text('улица, дом, корпус, строение, офис').css('margin', '2px 5px') } }, { name: 'citiesid', editable: true, edittype: 'select', editoptions: { defaultvalue: 2, value: function () { var cities = new object(); $.ajax({ url: "/map/getcities", datatype: "json", async: false, success: function (data) { $.each(data.rows, function (index, item) { cities[item.cell[0]] = item.cell[1]; }); } }); return cities; } } }, { name: 'phone', editable: true, editoptions: { datainit: function (item) { $(item).attr('placeholder', '+7 (812) 702-60-65'); } } }, { name: 'weburi', editable: true, editrules: { url: true }, editoptions: { datainit: function (item) { $(item).attr('placeholder', 'http://rlp.su'); } } }, { name: 'additionally', editable: true, edittype: 'textarea', editoptions: { rows: "3", cols: "56" } } ), toolbar: [true, "top"], sortname: 'name', viewrecords: true, rownumbers: true, sortorder: "desc", width: gridwidth, height: gridheight, pager: '#objectsmappager', caption: "Справочник организаций" }).jqgrid('navgrid', '#objectsmappager', pagersettings, // edit { recreateform: true, beforeshowform: function (form) { customform(form); } }, // add { recreateform: true, beforeshowform: function (form) { customform(form); } }, // delete deletesettings, // search searchsettings ); //$('#objectsmap').jqgrid('filtertoolbar');
Comments
Post a Comment