how to save the selection in a list

LabKey Support Forum (Inactive)
how to save the selection in a list feifei bao  2015-04-25 14:08
Status: Closed
 
Hi,

I have a question that after selecting some rows(using checkboxes) in a list, how can I use information(for example: disease column) based on the selected rows in another wiki page?

Thank you very much.

Feifei
 
 
feifei bao responded:  2015-04-25 14:37
Also if my column in the list has two different values, how can I link them to different urls? In the "edit design" I can only add one url.

Best regards,

Feifei
 
Jon (LabKey DevOps) responded:  2015-04-27 17:02
Hi Feifei,

Can you provide us with more descriptive details as to what you're needing?

Please describe what you expect the end-user to experience with those checkboxes.

And regarding the column having two different URLs, that wouldn't be possible with the current design since the XML metadata only allow one URL to be used per column.

Regards,

Jon
 
feifei bao responded:  2015-04-27 20:17
Sure. For a list, users can select some certain rows by checkbox showed on the first column. How can I show the selected rows on another wiki page? Or extract information from the selected rows.

Regarding the URLs issus, can I realize this by javascript API when I create the query web part ?

Thank you very much.

Feifei
 
Jon (LabKey DevOps) responded:  2015-04-28 11:39
Hi Feifei,

Just to make sure we're on the same page, is this what you're asking:

1. A user is on one page with a query web part displaying.
2. The user clicks on a few checkboxes that correspond with various rows in your query web part.
3. The user then clicks something like a button which then takes them to another wiki page.
4. When that wiki page loads, it will contain just the information from the other page that corresponds with the checked items.

Is that correct?

Regarding the URLs, the Javascript API will not be able to support that correctly. You might be able to get away with having different URLs by having users go to one URL that in-turn redirects them to another URL based on the value of what was clicked, but that would require more work to get the redirect setup on your end.

Regards,

Jon
 
feifei bao responded:  2015-04-28 11:51
Yes, your understanding is right. That is what I want to realize.

Best regards,

Feifei
 
Jon (LabKey DevOps) responded:  2015-04-28 12:43
Hi Feifei,

In order to pass selected data from your one query web part from one wiki page over to another wiki page, you would have to:

1. Setup a custom button either in Javascript or in the XML Metadata and use the onClick option to trigger the Javascript.

https://www.labkey.org/wiki/home/Documentation/page.view?name=customButtonBars
https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.QueryWebPart.html#constructor

2. Your onClick would have to specifically identify just the rows that were checked on (probably using something like .checked on those checkbox objects - http://www.javascriptkit.com/jsref/checkbox.shtml)

3. Once the boxes that are checked on are identified, the rowIDs and/or the values for all of those identified rows would need to be put in an array and then passed into a Labkey ActionURL (a buildURL in this case - https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.ActionURL.html#.buildURL) to construct the path to the other wiki page and add the array to a parameter to be used by the other wiki page and then the user would be redirected via window.location)

4. Your other wiki page would then have to take the values that were passed into the URL as an array and then either use the values from that URL via another Labkey ActionURL (probably getParameters or getParameterArray - https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.ActionURL.html#.getParameterArray) and use those parameters within your query web part Javascript API code or use it as a apart of a selectRows Javascript API call.

Regards,

Jon
 
feifei bao responded:  2015-05-03 21:54
Hi Jon,

I have some questions about step2 you mentioned above. How can I refer to the default checkbox column in the list in lackey? Could you please give me an example about this specifically identify?

What's more, can I have a way to customize the user query column to be a checkbox column?

Thank you very much.

Feifei
 
Jon (LabKey DevOps) responded:  2015-05-06 12:16
Hi Feifei,

If you use a web debugging tool like Firebug or Google Chrome's JConsole, you can inspect the elements of the list (specifically one of the checkboxes in the first column). All of the checkboxes have a name of ".select", so you can setup a button to identify those that are checked on like this for your XML metadata:

<tables xmlns="http://labkey.org/data/xml">
  <table tableName="ListTest" tableDbType="NOT_IN_DB">
    <columns></columns>
        <buttonBarOptions position="top" includeStandardButtons="true" >
        <item text="OnCLickButton">
          <onClick><![CDATA[
                        for (i=0; i < document.getElementsByName(".select").length; i++){
                            if (document.getElementsByName(".select")[i].checked){
                                alert("Box number " + i + " in the array is checked. Its key value is " + document.getElementsByName(".select")[i].value);
                            }
                        }
                    ]]></onClick>
        </item>
    </buttonBarOptions>
  </table>
</tables>

The XML above creates a button that will identify which boxes are checked and bring up an alert respectively showing which box was checked and the corresponding value of that checkbox that is tied to the specific row.

Regarding your follow-up question, I'm not sure I understand what you're asking here. What user query column are you referring to? Can you provide a screenshot so I can get a better idea of what you're asking to change?

Regards,

Jon