Page 1 of 1
dispatch "DeleteLine" to group not working
Posted: Thu Dec 28, 2017 8:45 pm
by yeldarb
I have a datagrid object that gets populated with data correctly. Each row has a button to delete that record. After some processing I send the "DeleteLine" command:
Code: Select all
dispatch "deleteline" to group "recordsGrid" with whichRecLine
but nothing happens to the datagrid. What's odd is that if I send the exact same message from the message dialog the row gets deleted.
Re: dispatch "DeleteLine" to group not working
Posted: Fri Dec 29, 2017 12:08 am
by quailcreek
From within the datagrid things work a little differently.
Try this:
Code: Select all
dispatch "deleteLine" to the dgControl of the target with whichRecLine
Re: dispatch "DeleteLine" to group not working
Posted: Fri Dec 29, 2017 3:01 pm
by yeldarb
Thanks, but the command is being dispatched from the card script. I tried what you suggested and still no luck. I also tried re-filling the DG with the affected data (since I delete the pertinent line from the data and save it to a file) but that doesn't work either. The grid gets populated on openCard, and the data gets deleted, and if I leave the card and come back the deleted line is gone, but I can't get the grid to refresh at the time of deletion.
Here's my card script
Code: Select all
local allRecords
on openCard
fillRecordsGrid
end openCard
on fillRecordsGrid
put getTheRecords() into allRecords
set the itemDelimiter to tab
put 0 into counter
repeat for each line thisLine in allRecords
add 1 to counter
put item 1 of thisLine into recordArray[counter]["profile"]
put item 2 of thisLine into recordArray[counter]["date"]
put item 3 of thisLine into recordArray[counter]["time"]
put item 5 of thisLine into recordArray[counter]["facets"]
end repeat
set the dgData of group "recordsGrid" to recordArray
end fillRecordsGrid
on deleteRecord theDGLine
put line theDGLine of allRecords into theRecord
put "Are you sure you want to delete the quiz results for @nickname from @date at @time?" into theQuestion
put item 1 of theRecord into nickname
set the itemDel to ","
put item 1 of nickname into nickname
replace "@nickname" with nickname in theQuestion
set the itemDel to tab
replace "@date" with item 2 of theRecord in theQuestion
replace "@time" with item 3 of theRecord in theQuestion
answer theQuestion with "DELETE" or "CANCEL"
if it is "CANCEL" then exit deleteRecord
delete line theDGLine of allRecords
saveRecords allRecords
dispatch "deleteline" to group "recordsGrid" with theDGLine
end deleteRecord
on viewReport theDGLine
put line theDGLine of allRecords into theRecord
set the itemDel to tab
put item 1 of theRecord into fld "profile" of card "results"
put item 4 of theRecord into fld "facetArray" of card "results"
goCard "results"
dispatch "createReport" to card "results"
end viewReport
Re: dispatch "DeleteLine" to group not working
Posted: Fri Dec 29, 2017 3:23 pm
by yeldarb
Nevermind... I had the "Persistent Data" box ticked. Unchecked it, and now it's working as expected.

Re: dispatch "DeleteLine" to group not working
Posted: Fri Dec 29, 2017 9:46 pm
by quailcreek
Sorry, I thought when you said that there was a btn in the DG that the code was in the DG too.