Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > How to create a choose form with tree checkbox from Departments and Users Catalogs?

Forum

Search UsersRules
How to create a choose form with tree checkbox from Departments and Users Catalogs?
#1
Just came
Points:: 0
Joined:: Aug 17, 2012

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?

Profile
#2
Active user
Points:: 0
Joined:: Sep 26, 2012

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

Profile
#3
Just came
Points:: 0
Joined:: Aug 17, 2012

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.

Profile
#4
Active user
Points:: 0
Joined:: Sep 26, 2012

> 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

Profile
#5
Just came
Points:: 0
Joined:: Aug 17, 2012

Thank you very much  :)

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.