[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 46/219: Manage_Table : Improve Javascript for
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 46/219: Manage_Table : Improve Javascript for adding / removing row of table |
Date: |
Mon, 18 Dec 2017 13:22:36 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 0e95617873b190be40c9d4f09e516804ddebb9fb
Author: Dany De Bontridder <address@hidden>
Date: Wed Sep 13 00:06:37 2017 +0200
Manage_Table : Improve Javascript for adding / removing row of table
---
html/js/managetable.js | 8 +++++---
include/lib/manage_table_sql.class.php | 34 +++++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/html/js/managetable.js b/html/js/managetable.js
index 84c2d88..fe125da 100644
--- a/html/js/managetable.js
+++ b/html/js/managetable.js
@@ -97,8 +97,10 @@ var ManageTable = function (p_table_name)
// use the table
//compute the length of row
//if rows == 0 or the sort is not defined then append
- if ( sort_column=-1 || p_table.rows.length < 2 ||
p_table.rows[1].cells[sort_column] == undefined ||
p_table.rows[1].cells[sort_column].getAttribute('sort_value') == undefined ) {
- p_table.appendChild(p_element_row);
+ if ( this.sort_column==-1 || p_table.rows.length < 2 ||
p_table.rows[1].cells[sort_column] == undefined ||
p_table.rows[1].cells[sort_column].getAttribute('sort_value') == undefined ) {
+ var row=p_table.insertRow(p_table.rows.length);
+ row.innerHTML=p_element_row.innerHTML;
+ row.id=p_element_row.id;
return;
}
// loop for each row , compare the innerHTML of the column with the
@@ -262,7 +264,7 @@ var ManageTable = function (p_table_name)
var answer = here.parseXML(req);
if (answer['status'] == 'OK') {
var x=answer['ctl_row'];
- $(x).hide();
+ $(x).remove();
alternate_row_color("tb"+answer['ctl']);
}else {
smoke.alert("Effacement impossible");
diff --git a/include/lib/manage_table_sql.class.php
b/include/lib/manage_table_sql.class.php
index 4678b9e..087828e 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -114,6 +114,13 @@ class Manage_Table_SQL
$this->col_sort=0;
}
/**
+ * send the XML headers for the ajax call
+ */
+ function send_header()
+ {
+ header('Content-type:text/xml;charset="UTF-8"');
+ }
+ /**
* When adding an element , it is column we checked to insert before,
* @return none
*/
@@ -177,9 +184,34 @@ class Manage_Table_SQL
/**
* This function can be overrided to check the data before
- * inserting , updating or removing,
+ * inserting , updating or removing, above an example of an overidden check
* @see set_error get_error
* @return boolean
+ * @code
+function check()
+ {
+ global $cn;
+ $table=$this->get_table();
+ $is_error=0;
+ $insert=false;
+ // sect_codename must be unique
+ if ( $table->exist() > 0) {
+ $insert=1;
+ }
+ $count=$cn->get_value(" select count(*) from syndicat.treasurer where
tr_login=$1 and sect_id=$2 and tr_id<>$3",
+ array(
+ $table->tr_login,
+ $table->section_full_name,
+ $table->tr_id
+ ));
+ if ($count > 0 ) {
+ $this->set_error("section_full_name",_("Ce trésorier a déjà accès
à cette section"));
+ $is_error++;
+ }
+ if ( $is_error > 0 ) return false;
+ return true;
+ }
+ * @endcode
*/
function check()
{
- [Noalyss-commit] [noalyss] 128/219: Esthetic, (continued)
- [Noalyss-commit] [noalyss] 128/219: Esthetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 99/219: CSS : button border, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 108/219: task #0001272: Rendre possible l'appel de la calculatrice depuis le fin fond d'une page., Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 174/219: space, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 114/219: Change max article in STOCK INV, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 16/219: Update test with new architecture, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 173/219: Improve calc, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 104/219: Réécriture de CFGPCMN pour utiliser ManageTable pas de delete proposé si compte utilisé, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 14/219: Infobulle : warning : esthetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 44/219: fix minor bug + doc, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 46/219: Manage_Table : Improve Javascript for adding / removing row of table,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 27/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation Check with the view v_quant_detail and take into account the negative VAT, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 33/219: Task #0001324: Afficher la date (période) dans FSALDO, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 198/219: Task #001381 : reinitialize the search_form, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 154/219: Task #1440 CA - opération diverses inaccessibles Task #1370 les OD en comptabilité analytique - problème., Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 209/219: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 186/219: Protect queryString with encodeURI, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 207/219: Task #1381 Change esthetic Search Filter, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 208/219: Fix search for reconcile, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 157/219: Fix issue with open_basedir, sometime set in the server config, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 196/219: Task #001381 : favori de filtre , table pour sauvegarder, Dany De Bontridder, 2017/12/18