{% extends "admin/base_site_grid.html" %} {% load i18n %} {% load static %} {% block extrahead %}{{block.super}} {% if debug_js %} {% else %} {% endif %} {% endblock %} {% block extracontainer %}data-ng-app="operationplandetailapp"{% endblock %} {% block tools %}{% if args %}{% include "common/snippet_follow.html" %}{% tabs model %}{% endif %}{% endblock %} {% block extra_grid %} onSelectAll: function(aRowids,status){ var selection = $(this).jqGrid('getGridParam','selarrrow'); var selectiondata = []; jQuery.each(selection , function(index,item) { selectiondata.push(jQuery("#grid").getRowData(item)); }); if (status === true) angular.element('#controller').scope().processAggregatedInfo(selectiondata, jQuery("#grid").jqGrid ('getGridParam', 'colModel')); else angular.element('#controller').scope().displayInfo(undefined); }, beforeSaveCell: function(rowid, cellname, value, iRow, iCol) { var selection = $(this).jqGrid('getGridParam','selarrrow'); var selectiondata = []; var rowdata = {}; var temprow = jQuery("#grid").getRowData(rowid); jQuery.each(selection , function(index,item){ if (item === rowid) { //update temprow temprow[cellname] = value; selectiondata.push(temprow); } else { rowdata = jQuery("#grid").getRowData(item); //if is being edited if (typeof $("#" + item +" input").attr('cm','[Object Object]').not('.cbox').val() !== 'undefined') { if ($("#" + item).hasClass('success')) { if (typeof $("#" + item +" input").attr('cm','[Object Object]').not('.cbox').attr("id") !== 'undefined') { colname=$("#" + item +" input").attr('cm','[Object Object]').not('.cbox').attr("id").split("_")[1]; if (typeof colname !== 'undefined') { rowdata[colname] = $("#" + item +" input").attr('cm','[Object Object]').not('.cbox').val(); } } } } selectiondata.push(rowdata); } }); if (selection.length > 1) angular.element('#controller').scope().processAggregatedInfo(selectiondata, jQuery("#grid").jqGrid ('getGridParam', 'colModel')); else angular.element('#controller').scope().displayonpanel(rowid, cellname, value); }, onSelectRow: function(rowid, status, e) { var selection = []; if ($(this).jqGrid('getGridParam').multiselect === true) { selection = $(this).jqGrid('getGridParam','selarrrow').slice(); } else { selection = [$(this).jqGrid('getGridParam','selrow').slice()]; } grid.markSelectedRow(selection.length); var selectiondata = []; var rowdata={}; var colname = ""; var editedval = ""; jQuery.each(selection , function(index,item) { rowdata = jQuery("#grid").getRowData(item); var elem = $("#" + $.escapeSelector(item) +" input"); editedval = elem.attr('cm','[Object Object]').not('.cbox').val(); if ( typeof elem.attr('cm','[Object Object]').not('.cbox').val() !== 'undefined' ) { if (typeof elem.attr('cm','[Object Object]').not('.cbox').attr("id") !== 'undefined') { colname=elem.attr('cm','[Object Object]').not('.cbox').attr("id").split("_")[1]; if (typeof colname !== 'undefined') { rowdata[colname] = elem.attr('cm','[Object Object]').not('.cbox').val(); } } } selectiondata.push(rowdata); }); if (selectiondata.length > 1) { angular.element('#controller').scope().processAggregatedInfo(selectiondata, jQuery("#grid").jqGrid ('getGridParam', 'colModel')); } else if (selectiondata.length === 1) { angular.element('#controller').scope().displayInfo(selectiondata[0]); } else { angular.element('#controller').scope().displayInfo(undefined); } }, multiboxonly: false, {% endblock %} {% block after_table %}
{% endblock %}