How to create a choose form with tree checkbox from Departments and Users Catalogs?

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Aug 17, 2012
Company:

I want to create tree checkbox like this :
    - Department1
      --User 1
      --User 2
    - - Department1.1
        ----User 3
        ----User 4
    - - Department1.2
        ----User 5
        ----User 6
    - Department2
      --User 9
      --User 10....
How to do this?

 
#2
People who like this:0Yes/0No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

I can suggest doing it by using "Value Tree" on form.
And use for checkbox in Value Tree attribute with type "Boolean"

Edited: ivan avdonin - Aug 19, 2014 10:18 PM
 
#3
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Aug 17, 2012
Company:

Thanks for yr suggest. I will try yr method
Could y show me how to query data from 2 catalogs Departments and Users and output to Attribute2?
How to auto check all Users  when a Department checked?
Thanks for reading my question.

Edited: Quynh Chi' - Aug 20, 2014 01:55 AM
 
#4
People who like this:0Yes/0No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

> how to query data from 2 catalogs Departments and Users and output to Attribute2?

like so:

Code
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   Query = new Query("SELECT Catalog1.Ref, Catalog1.Description FROM Catalog.Catalog1 AS Catalog1");
   choosing = Query.Execute().Choose();
   
   Query = new Query("SELECT Catalog2.Ref, Catalog2.Description, Catalog2.Attribute1 FR OM Catalog.Catalog2 AS Catalog2");
   catalog2 = Query.Execute().Unload();
   catalog2.Indexes.Add("Attribute1");
   
   lTree = FormAttributeToValue("Tree");
   
   while choosing.Next() do
      newRow = lTree.Rows.add();
      newRow.Attribute2 = choosing.Description;
      
      rows = catalog2.FindRows(new Structure("Attribute1", choosing.Ref));
      For each lRow In rows do
         newRow2 = newRow.Rows.add();
         newRow2.Attribute2 = lRow.Description;
      enddo;
   enddo;
   
   ValueToFormAttribute(lTree, "Tree");
EndProcedure


> How to auto check all Users when a Department checked?

You need process OnChange event handler of Attribute1

Code
&AtClient
Procedure TreeAttribute1OnChange(Item)
   currentRow = Items.Tree.CurrentData;
   
   SubRows = currentRow.GetItems();
   For each subRow In SubRows do
      subRow.Attribute1 = currentRow.Attribute1;
   enddo;
EndProcedure

 
#5
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Aug 17, 2012
Company:

Thank you very much  :)

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.