[CLOSED] PropertyGrid and ComponentLoader

  1. #1

    [CLOSED] PropertyGrid and ComponentLoader

    I'm trying to load a PropertyGrid through a Loader. Is this possible? It's only showing the header - no properties.

    Here's a sample:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestExtNet.aspx.cs" Inherits="Test.TestExtNet" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
       <title></title>
       <script runat="server">
          [DirectMethod]
          public string TestLoader( Dictionary<string, string> parameters )
          {
             PropertyGrid propertyGrid = new PropertyGrid { ID="testId", Title = "Test", SortableColumns = false, Editable = false, HideHeaders = true, NameColumnWidth = 190, Width = 600 };
    
             propertyGrid.AddProperty( new PropertyGridParameter( "prop1", "value1" ) { Mode = ParameterMode.Raw } );
             propertyGrid.AddProperty( new PropertyGridParameter( "prop2", "value2" ) { Mode = ParameterMode.Raw } );
             propertyGrid.AddProperty( new PropertyGridParameter( "prop3", "value3" ) { Mode = ParameterMode.Raw } );
    
             return ComponentLoader.ToConfig( propertyGrid);
          }
       </script>
    </head>
    <body>
       <form id="form1" runat="server">
          <ext:ResourceManager runat="server" />
          <ext:Panel ID="testLoader" runat="server" Title ="Test loader">
             <Loader runat="server" Mode="Component" DirectMethod="#{DirectMethods}.TestLoader" RemoveAll="true" />
          </ext:Panel>
       </form>
    </body>
    </html>
    Thank you!
    Last edited by fabricio.murta; Jun 28, 2017 at 8:44 PM.
  2. #2
    Hello @Edgar!

    First of all, thanks for the test case, I could run it and I'm positive on the right answer for you here!

    There are two issues on your test case:
    1. the way you are adding properties works to add them to existing grids. For still not rendered ones you should either delay and then add that way, or populate the property grid's Source object. So, the correct way in your scenario, to populate the initial set of properties, would be:
    propertyGrid.Source.Add(<property grid parameter here>);

    2. you are passing 'raw' invalid JavaScript arguments, thus they don't get interpreted at all. If you send value1 as ParameterMode.Raw, then the client side will throw an error about reference to the undefined variable value1. You probably want to drop the argument to set the parameter as raw. Or just add the quotes as you wish (or turn it into a proper code, for example). That would take your lines for something like that (if adding single quotes instead):
    propertyGrid.Source.Add( new PropertyGridParameter( "prop1", "'value1'" ) { Mode = ParameterMode.Raw } );

    With these two modifications it worked fine here.

    Just to clarify the point (1) above: you were calling a method to add properties to an existing property panel, while you are but instantiating your new one and you could either wait for it to be drawn to call the methods (in another direct method, guaranteed to be run after the grid is ready), or just populate its property store (called Source).

    I hope this clarifies your inquiry! :)
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello @edgar!

    Been some time we provided an answer for your inquiry here and still no feedback from you. Did the answer fulfill your question, or do you still need assistance with this issue?..

    We may mark this thread as closed if you don't provide us feedback in 7+ days from now. But don't worry, you will still be able to post here if/when you feel like.

    Looking forward to your feedback!
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Hello FabrÃ*cio!

    Sorry for the late reply. Management went for a different approach as we had to provide a POC in a couple of hours. I just tested the modifications you've suggested and I can confirm it works. I hope it will help someone else in the future.

    Muito obrigado!
  5. #5
    Hello @Edgar!

    Glad you could find a solution and that the proposed one also would be suitable to help! Thanks for the feedback.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 10
    Last Post: Sep 19, 2017, 6:36 AM
  2. Replies: 1
    Last Post: Apr 04, 2015, 5:24 PM
  3. ComponentLoader and Explicit Id
    By ETICS in forum 2.x Help
    Replies: 0
    Last Post: Jun 26, 2013, 4:21 PM
  4. [CLOSED] ComponentLoader inconsistency
    By RCN in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 07, 2012, 12:24 PM
  5. [CLOSED] ComponentLoader issue
    By RCN in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 12, 2012, 9:28 PM

Tags for this Thread

Posting Permissions