EasyUI Forum
March 29, 2024, 12:03:03 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: treegrid / prevent the grouping of lines of node after adding  (Read 11444 times)
lolodev
Newbie
*
Posts: 5


View Profile
« on: December 21, 2016, 04:04:47 AM »

hi !

my question is about gathering in treegrid.
when i add new item in treegrid, i want to prevent the grouping of lines of node and add new item for this node.

do you have a way ?

thanks
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: December 21, 2016, 03:30:31 PM »

i want to prevent the grouping of lines of node and add new item for this node.

Please describe your question in more detail.
Logged
lolodev
Newbie
*
Posts: 5


View Profile
« Reply #2 on: December 22, 2016, 12:27:04 AM »

ok thanks

Above the treegrid, I have a button add a product.
When I click on a product family, I add a product via a modal window. I validate the addition, the treegrid page is reloaded and therefore folds the tree.

haw can i prevent this reload or how can i push an ID to open treegrid ?

thanks
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #3 on: December 22, 2016, 05:10:24 PM »

Using the 'window' or 'dialog' components don't force the page to refresh again. If you are adding some new data into the treegrid, you can call 'append' or 'insert' methods to achieve this functionality without reloading the treegrid again.
Logged
lolodev
Newbie
*
Posts: 5


View Profile
« Reply #4 on: December 23, 2016, 06:17:30 AM »

thanks

but i think i use dialog to add an item.

here the code to add item :
Code:
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="addfiche()">Ajouter un produit</a>

Code:
/**
 *
 * AJOUT D'UNE FICHE
 *
 */

function addfiche(){

    var editRowDialog = $("#editRowDialog");

    editRowDialog.dialog({title: 'Ajouter une fiche'});

    var form = $('#editRowDialog > form');


    var row = $('#tt').treegrid('getSelected');
    var idparent;
 
    if (row != undefined){
        if (row.isparent == 1){
            idparent = row.idfamille;
        }else if (row._parentId != 0){
            idparent = row._parentId;
        }
    }

    form.empty();

    form.append('<div class="fv-grp"><input type="hidden" name="type" value="3">'); /* type : Ajout Fiche*/
    form.append('<div class="fv-grp"><label for="nom">Nom : </label><input type="text" name="nom" value="" required></div>');
    form.append('<div class="fv-grp"><label for="ordre">Ordre : </label><input type="text" name="ordre" value=""></div>');
    form.append('<div class="fv-grp"><label for="prixttc">Prix TTC : </label><input type="text" name="prixttc" value=""></div>');
    form.append('<div class="fv-grp"><label for="unite">Unité : </label><input type="text" name="unite" value=""></div>');
    //form.append('<div class="fv-grp"><label for="uniteprix">Unité Prix : </label><input type="text" name="uniteprix" value=""></div>');
form.append('<div class="fv-grp"><label for="uniteprix">Unité Prix : </label><select name="uniteprix" id="cmbuniteprix"></select></div>');
    form.append('<div class="fv-grp"><label for="groupe">Groupe : </label><input type="checkbox" name="groupe"></div>');
    form.append('<div class="fv-grp"><label for="groupe2">Groupe 2 : </label><input type="checkbox" name="groupe2"></div>');
    form.append('<div class="fv-grp"><label for="volaille">Volaille : </label><input type="checkbox" name="volaille"></div>');
    form.append('<div class="fv-grp"><label for="exactcompt">Exact. Compt. : </label><input type="text" name="exactcompt" value=""></div>');
    //form.append('<div class="fv-grp"><label for="prixpoids">Prix Poids : </label><input type="text" name="prixpoids" value=""></div>');
form.append('<div class="fv-grp"><label for="prixpoids">Prix Poids : </label><input type="checkbox" name="prixpoids"></div>');

    form.append('<div class="fv-grp"><label for="parent">Parent : </label><select name="parent" id="cmbparent"></select></div>');
    var cmbParents = $("#cmbparent");
    var i;
    var j;

    cmbParents.empty();



    if (row != undefined){
        if (row.isparent == 1){
            idparent = row.idfamille;
        }else if (row._parentId != 0){
            idparent = row._parentId;
        }
    }
    for (i = 0; i < nodes.length; i++){
        if(nodes[i].isparent == 1){

            if(idparent != undefined && idparent == nodes[i].idfamille){
                cmbParents.append('<option value="' + nodes[i].idfamille + '" selected> - '+ nodes[i].libelle +'</option>');
            }else{
                cmbParents.append('<option value="' + nodes[i].idfamille + '"> - '+ nodes[i].libelle +'</option>');
            }
            for (j = 0; j < nodes[i].children.length; j++){
                if (nodes[i].children[j].isparent == 1){
                    if(idparent != undefined && idparent == nodes[i].children[j].idfamille){
                        cmbParents.append('<option value="' + nodes[i].children[j].idfamille + '" selected> - - '+ nodes[i].children[j].libelle +'</option>');
                    }else{
                        cmbParents.append('<option value="' + nodes[i].children[j].idfamille + '"> - - '+ nodes[i].children[j].libelle +'</option>');
                    }
                }
            }
        }
    }

var cmbuniteprixx = $("#cmbuniteprix");
cmbuniteprixx.empty();
cmbuniteprixx.append('<option value="34"> Kg </option>');
cmbuniteprixx.append('<option value="36"> Unite </option>');
cmbuniteprixx.append('<option value="35"> Bouteille </option>');
cmbuniteprixx.append('<option value="56"> Lot </option>');
cmbuniteprixx.append('<option value="57"> Litre </option>');

    form.append('<div class="fv-grp"><button type="submit" onclick="sendForm()">Valider</button><a href="#" onclick="$(\'#editRowDialog\').dialog(\'close\')"><button type="button">annuler</button></a></div>');



    editRowDialog.dialog({
        closed: false
    });
    editRowDialog.dialog('center');
}
Logged
lolodev
Newbie
*
Posts: 5


View Profile
« Reply #5 on: January 02, 2017, 01:51:26 PM »

hi

happy new year

is someone can help me please ?
Logged
lolodev
Newbie
*
Posts: 5


View Profile
« Reply #6 on: January 02, 2017, 01:58:09 PM »

here code to call treegrid:

Code:
<style type=text/css>

</style>
<div style="margin:20px 0;">
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="addparent()">Ajouter une famille</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="addfiche()">Ajouter un produit</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" onclick="deleterow()">Supprimer</a>

</div>

<table id="tt"></table>

<div id="editRowDialog" class="fv-dialogs">
    <form action="../../../modules/catalogue/data/save.php" method="post" id="#envoi">
    </form>
</div>
<div id="result"></div>

<script src="../../../modules/catalogue/data/treeModule.js"></script>

when i valide dialog page to add an item, i call save.php to save data in mysql.
and after i use js to reload page

Code:
echo "<script>window.location='/fv/admin/fr/182.htm?script=index.php'</script>";

is it possible to POST node id and open treegrid to this node id ??
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #7 on: January 02, 2017, 08:44:07 PM »

You should use ajax form to submit your form data. Please look at this example http://www.jeasyui.com/demo/main/index.php?plugin=Form&theme=default&dir=ltr&pitem=Ajax%20Form
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!