1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    48
    Vote Rating
    0
    $p00ky is on a distinguished road

      0  

    Question Advises for a beginner (a list of forms)

    Advises for a beginner (a list of forms)


    Dear all,

    I am new in the Sencha world and have read the Getting Started Guide as well as many examples and API references.
    The framework looks very promising and I might use it for a new simple project.

    There are so many components that I would like to have your wise advise about which components to use for my project.

    I basically have entries which can have comments and would like to display all the entries (or some of them through filters) along with their comments and allow the users to add comments.

    Here is a very rapid prototype of the concept:


    There could be many more entries and many more comments.
    When the users 'POST' a comment, it adds a comment to that entry.

    I am planning to hold the data in JSON format and use an ajax proxy.
    An example of a message returned by the server is as follows (the format can evolve depending on ExtJS needs):
    There are 'entries' that have 'comments' children.

    Code:
    {
        'success': true,
        'total': 2,
        'entries': [
            {
                'id': 0,
                'title': 'my title 0',
                'otherField': 'otherValue',
                'entryComments': {
                    'total' : 0,
                    'comments' : []
                }
            },
            {
                'id': 1,
                'title': 'my title 1',
                'otherField': 'otherValue',
                'entryComments': {
                    'total' : 2,
                    'comments' : [
                        {
                            'id': 0,
                            'userId': 41,
                            'userName': 'user41',
                            'content': 'my super comment 0'
                        },
                        {
                            'id': 1,
                            'userId': 57,
                            'userName': 'user57',
                            'content': 'another comment'
                        }
                    ]
                }
            }
        ]
    }
    I had a first short try based on the example in "Getting Started" replacing the "Grid" by a "View" and it works fine (just to displays the entries and popup a form when an entry is clicked).
    I would like to change it to a list of forms, that doesn't pops up a form but is directly a form, that will post comments in AJAX so it doesn't refresh the page and dynamically insert the posted comment (in case of success) along with the existing comments.

    I plan to send the complete set of entries when the page is loaded (I should not have more than ~300 entries at a time) and provide local filtering/sorting, as well as 'reload' of the complete data.

    ExtJS seems very suitable for what I am looking for.
    Can anyone shade some lights on the components I should use to obtain this 'list of dynamic forms'?

    Cheers,

    $p00ky

  2. #2
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    71
    Vote Rating
    2
    softwarezman is on a distinguished road

      0  

    Default


    What you are talking about really sounds like one of their examples. Perhaps the 'Forms with VBox Layout'? It allows you to add email addresses and then it'll create a new row on the fly for an additional email address (similar to your comment fields that you are referring to?) I think it could be done this way.
    http://docs.sencha.com/ext-js/4-0/#!/example/form/vbox-form.html

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    48
    Vote Rating
    0
    $p00ky is on a distinguished road

      0  

    Question


    Indeed, this usage of the "child" items seems to be what I should use to insert the child comments in the form, thanks!

    However, this allows me to have 1 form, what if I want N forms in a vertical layout?

    I thought about the VBox layout, but it seems to require "static" items.
    In my case the elements (the forms) are dynamically retrieved (through the call to the server that returns the list of entries with their comments).

    How can I have a VBox layout of custom entities (in my case custom dynamic forms similar to the ones in the VBox Forms example themselves inside a VBox layout)?

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    71
    Vote Rating
    2
    softwarezman is on a distinguished road

      0  

    Default


    I don't think there is any reason why you couldn't create your custom form on the fly and insert it into the already existing 'parent' form. But I would question whether or not that was necessary if you only needed one comment form for adding new comments and the rest could simply be 'static' comment fields instead. You could do the same sort of insert into the form but instead of an additional form it could be a text field or a panel or any other type of component or you could literally insert a div into the parent form element.

    There are many different ways of doing it, it's all in the API's for what I'm talking about with the inserts etc so it really comes down to what type of interface do you want it to end up with.

  5. #5
    Sencha User
    Join Date
    Jan 2012
    Posts
    48
    Vote Rating
    0
    $p00ky is on a distinguished road

      0  

    Question


    Actually I am wondering what should be the "parent" of the forms?

    I understood how to generate a single form (with multiple comments and one text field / button) but now I want to generate multiple forms, in a vertical layout.

    Is it possible to "inject" the forms in a parent, and if so, what is the suggested parent? (Ext.container.Panel? VBox?)

  6. #6
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    71
    Vote Rating
    2
    softwarezman is on a distinguished road

      0  

    Default


    After rereading what you wrote, I think I may have gone off on a different direction. Whoops. Well from what I understand you could use a Ext.panel.panel, then add/insert components inside the panel like your custom form. You might have to create a panel with the form embedded in it and then add THAT panel to the original panel (somebody correct me on this one, I don't do this stuff very often) but that should do it.

  7. #7
    Sencha User
    Join Date
    Jan 2012
    Posts
    48
    Vote Rating
    0
    $p00ky is on a distinguished road

      0  

    Question


    OK so I need to embed the form in a panel and the panel inside the "main" panel?

    Can't I embed directly the forms in the main panel?
    Ext.container.Panel is the suggested container? (see my previous post)

    I was planning to have display fields on the form to display the entity fields and the current comments plus a textfield for the comment to write but it might be better to have a panel with the entity fields / current comments and the form being only the text field and the submit button.
    In that case, embed the form in a Panel itself embedded in the main Panel seems the solution, thanks!

  8. #8
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    71
    Vote Rating
    2
    softwarezman is on a distinguished road

      0  

    Default


    At this point I'd just say experiment. It should be easy enough to try and create a form on the fly and then inject it into a panel vs creating a panel/form on the fly and injecting THAT into a panel to see what happens. I'm just not sure how thing would go with a form inside a form but it is considered a container so maybe it'd be ok. Give it a try?

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar