[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14714] editable inline tables
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14714] editable inline tables |
Date: |
Tue, 09 Feb 2016 20:39:00 +0000 |
Revision: 14714
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14714
Author: sigurdne
Date: 2016-02-09 20:38:22 +0000 (Tue, 09 Feb 2016)
Log Message:
-----------
editable inline tables
Modified Paths:
--------------
branches/dev-syncromind/phpgwapi/js/jquery/common.js
branches/dev-syncromind/phpgwapi/templates/base/datatable_inline.xsl
Modified: branches/dev-syncromind/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind/phpgwapi/js/jquery/common.js 2016-02-09
14:39:47 UTC (rev 14713)
+++ branches/dev-syncromind/phpgwapi/js/jquery/common.js 2016-02-09
20:38:22 UTC (rev 14714)
@@ -221,7 +221,21 @@
var order = options['order'] || [0, 'desc'];
var responsive = options['responsive'] || false;
var initial_search = options['initial_search'] || false;
+ var editor_action = options['editor_action'] || false;
+ var editor_cols = [];
+ for(i=0;i < columns.length;i++)
+ {
+ if (columns[i]['editor'] === true)
+ {
+ editor_cols.push({sUpdateURL:editor_action +
'&field_name=' + columns[i]['data']});
+ }
+ else
+ {
+ editor_cols.push(null);
+ }
+ }
+
var lengthMenu = null;
try
{
@@ -312,6 +326,33 @@
// stateDuration: -1, //sessionstorage
// tabIndex: 1,
fnDrawCallback: function () {
+ if(typeof(oTable) != 'undefined')
+ {
+ oTable.makeEditable({
+ sUpdateURL: editor_action,
+ fnOnEditing: function(input){
+ var iPos =
input.closest("tr").prevAll().length;
+ var aData = oTable.fnGetData(
iPos );
+ id = aData['id'];
+ cell = input.parents("td");
+ return true;
+ },
+ fnOnEdited: function(status, sOldValue,
sNewCellDisplayValue, aPos0, aPos1, aPos2)
+ {
+
//document.getElementById("message").innerHTML += '<br/>' + status;
+ },
+ oUpdateParameters: {
+ "id": function(){ return id; }
+ },
+ aoColumns: editor_cols,
+ sSuccessResponse: "IGNORE",
+ fnShowError: function(){ return; }
+ });
+ }
+ if(typeof(addFooterDatatable) == 'function')
+ {
+ addFooterDatatable(oTable);
+ }
try
{
window['local_DrawCallback' +
JqueryPortico.inlineTablesRendered](oTable);
Modified: branches/dev-syncromind/phpgwapi/templates/base/datatable_inline.xsl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/base/datatable_inline.xsl
2016-02-09 14:39:47 UTC (rev 14713)
+++ branches/dev-syncromind/phpgwapi/templates/base/datatable_inline.xsl
2016-02-09 20:38:22 UTC (rev 14714)
@@ -309,6 +309,19 @@
},
</xsl:if>
+ <xsl:choose>
+ <xsl:when test="editor">
+ <xsl:if test="editor
=0">
+ editor: false,
+ </xsl:if>
+ <xsl:if test="editor
=1">
+ editor: true,
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ editor: false,
+ </xsl:otherwise>
+ </xsl:choose>
defaultContent: "<xsl:value-of
select="defaultContent"/>"
}<xsl:value-of
select="phpgw:conditional(not(position() = last()), ',', '')"/>
</xsl:for-each>
@@ -344,6 +357,9 @@
<xsl:if test="responsive">
options<xsl:number value="($num -
1)"/>.responsive = true;
</xsl:if>
+ <xsl:if test="editor_action">
+ options<xsl:number value="($num -
1)"/>.editor_action = "<xsl:value-of select="editor_action" />";
+ </xsl:if>
</xsl:for-each>
if (JqueryPortico.buttons<xsl:number value="($num - 1)"/>)
{
@@ -360,7 +376,8 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
-
- oTable<xsl:number value="($num - 1)"/> =
JqueryPortico.inlineTableHelper("<xsl:value-of select="$container"/>",
<xsl:value-of select="$requestUrl"/>, columns<xsl:number value="($num - 1)"/>,
options<xsl:number value="($num - 1)"/> , <xsl:value-of select="$dataset"/>);
+ $(document).ready(function() {
+ oTable<xsl:number value="($num - 1)"/> =
JqueryPortico.inlineTableHelper("<xsl:value-of select="$container"/>",
<xsl:value-of select="$requestUrl"/>, columns<xsl:number value="($num - 1)"/>,
options<xsl:number value="($num - 1)"/> , <xsl:value-of select="$dataset"/>);
+ });
</script>
</xsl:template>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14714] editable inline tables,
Sigurd Nes <=