Use standalone with a full table

Use standalone with a full table

bfarkasbfarkas Posts: 97Questions: 24Answers: 0

Is it possible to use the inline editor setup with a full table?
Here’s what I am thinking.
Having a modal window from a button that has the standalone in it which calls specific fields from the main table which the user can update here.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 52,525Questions: 1Answers: 8,020 Site admin

    I'm not clear why you would need a standalone Editor for that? You can have data shown only in the table and not in the form if you want.

    Allan

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    So in this setup, I have the form which is the main entry point.
    I also want to be able to call very specific cells into a different form triggered by its own button, so I was thinking of having a modal button that has a standalone page that defines those three specific cells as fields. I don;t want this to work for any row, so a second form would not necessarily be the best choice.
    Thanks,
    Brian

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    I guess a different way to look at it would be two forms needed for one table. So you could have the standard form, and then another one that has a different set of fields on it.

  • allanallan Posts: 52,525Questions: 1Answers: 8,020 Site admin
    Answer ✓

    Hi Brian,

    I'm with you now - thank you. Yes, you absolutely could do that. Just trigger the edit() action on your standalone Editor based on the row's id that activated the action.

    Allan

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    Thanks Allan, that's what I decided to work towards last night while reading around and hoping to work towards today.

    Here is my current dilema. I want to make sure there is a specific row, with certain data entered as the first row entered always, and this would be the same row that is edited.

    I am thinking I do roughly the following:
    1. Check to see if the row exists already
    2. If it does I load the data from that row as the data for editing.
    3. If it doesn't, I generate the row quickly with the pre-defined constant values, and then load that new row into the standalone editor.

    Thanks for your help and any thoughts on this approach are appreciated.
    Brian

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    Are there any good examples of using the edit() api to pull specific cell data from specific rows?

  • allanallan Posts: 52,525Questions: 1Answers: 8,020 Site admin

    I don't think there are any examples that work quite like this. However, based on your description, perhaps the best way to do it would be like:

    editor
      .edit(row.id)
      .set({
        field1: row.value1,
        field2: row.value2,
        // ...
      })
      .submit(() => {
        // callback function
      });
    

    You'd need to do your initial row check / create before that, but that's how you can use the API to do an edit without needing a host row.

    Allan

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    Hmm. I think I'm missing something, a connection maybe.
    The above suggestion works, but pulls open the editor form.
    How do I set it to basically use an html modal window with just 3 fields from the overall setup and show just the one row and let them be edited?

  • allanallan Posts: 52,525Questions: 1Answers: 8,020 Site admin

    Are you able to send me a screenshot or something of what you mean please? I'm not quite getting it - sorry!

    You say that opens the Editor form, but that isn't what you want? But you do want an Editor form with three fields?

    Allan

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    Absolutely, I meant to do that when i got back to a computer.
    Okay, so I have a table with editor:

    The first row entry will always be a bit different, and I have a bunch of processes to gurantee it is there and there is a unique value in Street to identify it. I have defined a custom entry form to be used for when clicking 'New' or 'Edit' etc. that lets the user enter the full data set which i want to keep for regular actions:

    Here's the tricky part. I have a button on the table, in that 'Nests' menu, which I have trigger a modal with a standalone editor currently. The goal would be each of the entries, Nest 1, Nest 2, Nest 3, would pull the value from that first row and the FIrst Name, Middle Name, Last Name columns where I have Value1,2,3 in the screenshot above. Then when they edit this entry in the modal window it updates that row. Here is a mockup of the modal:

    I know this is a bit strange, but it is the last hurdle to several to pull off something super useful. Any ideas?

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    Actually, I think I just thought of a really simple solution, but would love if you could confirm if there are potential issues with it.

    I simply setup a second editor, but pointed it at the same table.
    Then I defined only the 3 fields that I wanted and I can name them anything I want.

    I am then going to use the api to set the button to launch a modified edit modal that automatically selects that one row every time.

    Any known issues of having two editors working off of the one table instance?

  • allanallan Posts: 52,525Questions: 1Answers: 8,020 Site admin

    Good plan!

    Any known issues of having two editors working off of the one table instance?

    Nope - I've done it a lot as well.

    The key is just to make sure that when you submit an edit (or create) it will return the full data for the row.

    Allan

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    So in my case, I don't need to worry about that, as the only row the second editor gets to make is always there and there is no other way to edit it. I am essentially doing a one to many join but within one table so that I can stay entirely front end and allow the user to easily export/import the full dataset of what would be both tables.

    Thanks for all the help on this!

  • bfarkasbfarkas Posts: 97Questions: 24Answers: 0

    One thing that I seem to be running into in this setup is I can’t seem to use a custom form for both editors. The second one works fine for using the standard but when I switch it to a custom it shows a blank modal.

Sign In or Register to comment.