Skip to content

Instantly share code, notes, and snippets.

@vumanhcuongit
Created December 11, 2013 03:45
Show Gist options
  • Select an option

  • Save vumanhcuongit/7904799 to your computer and use it in GitHub Desktop.

Select an option

Save vumanhcuongit/7904799 to your computer and use it in GitHub Desktop.
$('#grid').w2grid({
name: 'grid',
show: {
lineNumbers: true,
footer: true
},
recordsPerPage: 100,
columns: [
{ field: 'month_report', caption: 'Month', size: '10%', resizable: true, sortable: true },
{ field: 'account_short_name', caption: 'Short Name', size: '15%', resizable: true,
render: function (record, index) {
return '<a href="index.php?module=Accounts&action=DetailView&record=' + record.account_id +'">'+ record.account_short_name +'</a>';
}
},
{ field: 'account_type', caption: 'Account Type', size: '10%', resizable: true},
{ field: 'account_location_area', caption: 'Area', size: '10%', resizable: true },
{ field: 'user_name', caption: 'Sale', size: '10%', resizable: true, sortable: true},
{ field: 'brand_name', caption: 'Brand', size: '15%', resizable: true,
render: function (record, index) {
return '<a href="index.php?module=Brands&action=DetailView&record=' + record.brand_id +'">'+ record.brand_name +'</a>';
}
},
{ field: 'brand_industry', caption: 'Industry', size: '15%', resizable: true },
{ field: 'contract_code', caption: 'Contract', size: '20%', resizable: true, sortable: true,
render: function (record, index) {
return '<a href="index.php?module=Contracts&action=DetailView&record=' + record.contract_id +'">'+ record.contract_code +'</a>';
}
},
{ field: 'account_name', caption: 'Account', size: '20%', resizable: true, sortable: true,
render: function (record, index) {
return '<a href="index.php?module=Accounts&action=DetailView&record=' + record.account_id +'">'+ record.account_name +'</a>';
}
},
{ field: 'ad_on_web', caption: 'Ads on Website', size: '15%', resizable: true,
render: function (record, index) {
if (record.report_type == 'Booking')
return '<a href="index.php?module=BookingExecution&action=DetailView&record=' + record.booking_id +'">'+ record.ad_on_web +'</a>';
if (record.report_type == 'BookingAd')
return '<a href="index.php?module=BookingAds&action=DetailView&record=' + record.booking_id +'">'+ record.ad_on_web +'</a>';
return record.ad_on_web;
}
},
{ field: 'web_page', caption: 'Webpage', size: '15%', resizable: true },
{ field: 'place_of_banner', caption: 'Place of Banner/PR/Production', size: '15%', resizable: true },
{ field: 'price_type', caption: 'Price Type', size: '10%', resizable: true },
{ field: 'date_start', caption: 'Start date', size: '10%', resizable: true, attr: "align=right" },
{ field: 'date_end', caption: 'End date', size: '10%', resizable: true, attr: "align=right" },
{ field: 'days', caption: 'No. of days', size: '10%', resizable: true, attr: "align=right" },
{ field: 'suspend_cpm_cpc', caption: 'Suspend / CPM/CPC', size: '10%', resizable: true, attr: "align=right" },
{ field: 'before_discount', caption: 'Before Discount', size: '10%', resizable: true, attr: "align=right" },
{ field: 'discount', caption: 'Discount', size: '12%', resizable: true, attr: "align=right" },
{ field: 'discount2', caption: 'Discount 2', size: '12%', resizable: true, attr: "align=right" },
{ field: 'total_amount', caption: 'Total Cost', size: '12%', resizable: true, attr: "align=right" },
{ field: 'booking_status', caption: 'Status', size: '10%', resizable: true },
{ field: 'reference_code', caption: 'ERP code', size: '10%', resizable: true },
{ field: 'team', caption: 'team', size: '10%', resizable: true }
],
records: {$PRODUCTS}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment