Maybe not the place for this, but I looked in my datagrid, and those scripts are not there. The buttons in DGH for Column sort, Reorder lines, Reorder columns, and Resize columns by double-click are all greyed out, which I assumed meant that the scripts were installed. If they were, it was not in the datagrid I had selected.
Bob On Feb 3, 2011, at 1:36 PM, zryip theSlug wrote: > On Thu, Feb 3, 2011 at 9:32 PM, Bob Sneidar <b...@twft.com> wrote: > > Hi Bob, > >> Hi all. >> >> I thought this was addressed before, but I have looked through the forums >> and the API to no avail. Is it now possible via the API to sort by multiple >> columns? I know I can get the dgText, sort with Rev API and set the dgText, >> but I want to try to use the Datagrid API as much as possible. >> >> I looked at the Datagrid Helper and saw some scripts for column sorting, so >> I installed them. Now it dawns on me I do not know how to call them, or get >> rid of them if I don't want them anymore. > > For column sorting, DGH builds a script according to the name of the > columns in the datagrid. The script is installed in the datagrid > group. > For example, in a datagrid with 3 columns: "First name", "Last Name", > "Phone number", the generated script must be something such as: > > switch pColumn > case "First name" > pass SortDataGridColumn > break > > case "Last Name" > pass SortDataGridColumn > break > > case "Phone number" > pass SortDataGridColumn > break > > default > pass SortDataGridColumn > end switch > > In the script comments, DGH gives also some clues for customizing this > switch case statement: > > ## Use: > # -> pass SortDataGridColumn for a regular sort > # -> don't pass SortDataGridColumn for disabling the column sort > ## For a multicriteria sort, use: > # -> SortDataByKey "col 1" -- name of the column of the first criteria > # -> SortDataByKey "col 2" -- name of the column of the second criteria > # -> SortDataByKey "col n" -- name of the column of the criteria n > # -> HiliteAndStoreSortByColumn "col 1" -- hilites the first column > after the multicriteria sort > ## For reversing the sort of a column, use: > # -> ReverseSort "col 1" > > In the next version of DGH, I'll clarify the parameters for the > SortDataByKey command. > > According to the API, this command accepts 4 parameters: > pArrayKey -> the name of the column > pSortType -> the type of data in the column (numeric, text, etc) > pDirection -> the direction of the sort (ascending, descending) > pCaseSensitive -> optional. Default is false > > Now, imagine that you need sorting the data by First name AND Last > name when one click on the "First name" header: > > switch pColumn > case "First name" > put the dgColumnSortDirection[pColumn] of me into > tSortDirection -- get the sort direction > SortDataByKey "First name", "text", tSortDirection, "false" > -- First criteria : sort by first name > SortDataByKey "Last name", "text", tSortDirection, "false" -- > Second criteria : sort by last name > > HiliteAndStoreSortByColumn "First name" -- Tell data grid to > hilite column > break > > > DGH not removes installed scripts. DGH could not detected if users had > updated a script and I would not take the risk to break something > built by users. > To remove the custom sort, just edit the script of the datagrid group > and delete the SortDataGridColumn handler installed by DGH. > > Best regards, > > -Zryip TheSlug- wish you the best! 8) > http://www.aslugontheroad.co.cc > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode