Skip to content

Instantly share code, notes, and snippets.

@vordan
Created July 4, 2015 17:30
Show Gist options
  • Save vordan/cbfe620cfdea6cc66495 to your computer and use it in GitHub Desktop.
Save vordan/cbfe620cfdea6cc66495 to your computer and use it in GitHub Desktop.
jqGrid initialization
pub.grd_mailing_campaign.jqGrid({
url: 'bl/bl_mailing_campaign.php',
postData: {
action : function() {return 'mailing_campaign_list';},
record_count : function() {return _recipients_grid_record_count();},
},
datatype: 'json',
mtype: 'POST',
jsonReader : {repeatitems: false},
caption: '',
colModel: [
{name:'id', label:'Code', hidden:true, key: true},
{name:'name', label:'Title', hidden:false, width:180, align:'left', sortable:true,},
{name:'email_subject', label:'Subject', hidden:false, width:250, align:'left', sortable:true,},
{name:'mailing_template_name', label:'Тemplate', hidden:false, width:180, align:'left', sortable:true,},
{name:'mailing_template_footer_name', label:'Footer', hidden:true, width:180, align:'left', sortable:true,},
{name:'date', label:'Created', hidden:false, width:70, align:'center', sortable:false, formatter:'date', formatoptions:formatter_date_options()},
{name:'submitted_date', label:'Sent', hidden:false, width:70, align:'center', sortable:false, formatter:'date', formatoptions:formatter_date_options()},
],
pager: $('#grd_mailing_campaign_pager'),
rowNum: 10,
altRows: true,
//rowList: [10, 20, 30],
viewrecords: true,
emptyrecords: "Nothing to display",
multiselect: false,
sortname: 'id',
sortorder: "asc",
ignoreCase: true,
rownumbers: false,
gridview: true,
width: 898,
height: 200,
beforeSelectRow: function (rowid) {
if ($(this).jqGrid("getGridParam", "selrow") === rowid) {
$(this).jqGrid("resetSelection");
_form_init();
_recipients_grid_initialize();
}
else {
return true;
}
},
onSelectRow : function(_row_id, _status) {
var _gridRow = $(this).getRowData(_row_id);
var _selected_id = _gridRow['id'];
var _rec_mailing_campaign = _campaign_read(_selected_id);
_recipients_grid_load(_selected_id);
_form_show(_rec_mailing_campaign);
_campaign_info.show(_selected_id);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment