On Wed, Oct 19, 2011 at 11:43 PM, zryip theSlug <zryip.thes...@gmail.com> wrote:
> on FillInData pDataArray > put pDataArray["LastName"] & \ > comma & space & pDataArray["FirstName"] & space & > pDataArray["MiddleName"] into tCurrentName > set the text of field "Name" of me to tCurrentName > put the dgIndex of me into tTheIndex > put (the dgIndex of me - 1) into tThePreviousIndex > if (tThePreviousIndex > 0) then > put GetDataOfIndex(tThePreviousIndex, "LastName") into tPreviousName > end if > if ((first char of tCurrentName is not first char of tPreviousName) > or (tThePreviousIndex is 0)) then > set the visible of group "spacer" of me to true > else > set the visible of group "spacer" of me to false > end if > end FillInData After a test trying to sort the datagrid I change my mind to use dgLine instead of dgIndex. The final result is: on FillInData pDataArray put pDataArray["LastName"] & \ comma & space & pDataArray["FirstName"] & space & pDataArray["MiddleName"] into tCurrentName set the text of field "Name" of me to tCurrentName put the dgLine of me into tTheLine put (the dgLine of me - 1) into tThePreviousLine if (tThePreviousLine > 0) then put GetDataOfLine(tThePreviousLine, "LastName") into tPreviousName end if if ((first char of tCurrentName is not first char of tPreviousName) or (tThePreviousLine is 0)) then set the visible of group "spacer" of me to true else set the visible of group "spacer" of me to false end if end FillInData I've uploaded a lab stack here: http://www.aslugontheroad.com/index.php?option=com_phocadownload&view=category&id=7:data-grid&Itemid=63 This is a very simple datagrid. Instead to have a "spacer" group, it has a button shown or not. Code is in the form behavior script Best regards, -- -Zryip TheSlug- wish you the best! 8) http://www.aslugontheroad.com _______________________________________________ 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