Button in data grid instead of dgHilitedLine

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Button in data grid instead of dgHilitedLine

Post by pTom » Sat Dec 07, 2013 4:12 am

I am finishing with the content management system (CMS) for my app and need to add a method for deleting uploads after they have already been uploaded. In the CMS, I am displaying all of the uploads for a single category in a data grid. Through that data grid, the author is able to view and modify the existing uploads (for example, if they spelled a word wrong, they can use this to make edits to correct the misspelling).

What I would like to add, is a button on each line of the data grid for deleting that line. I have searched but have been unable to find info on this (at least that I understand). Currently, if I click on the line like normal, it will take me to a display page. I want to be able to click the button instead to delete that particular line.

**Note: each line would have it's own button so the author has the option of deleting the line at some point if they choose to do so.

Can you give me some info on how I would accomplish this?

Thanks!
Tom

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Button in data grid instead of dgHilitedLine

Post by pTom » Sun Dec 08, 2013 10:51 pm

Nevermind, I figured it out. Found some stuff in the forums.

Just so everyone else knows how this is done, I put the data grid code in the button that is in the data grid rather than the data grid. I also unchecked the autohilight box in the data grid preferences so that the line does not hilight when it is clicked on.

By doing this, I can click on the data rid itself and get nothing. BUT if I click on the button within the data grid, then I get the response I am looking for.

I am slowly (emphasize the word "slowly") beginning to figure out data grids! lol

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Button in data grid instead of dgHilitedLine

Post by LCNeil » Mon Dec 09, 2013 11:32 am

Hi Tom,

Its great to see you are getting to grips with the beast that is DataGrids :)

In regards to your email, I believe you will need to send/dispatch a message to the datagrid in order for it to refresh the data contained withing. The message used to delete a line from the dataGrid and have it refreshed is-

Code: Select all

 put the dgHilitedIndex of group "datagrid" into theIndex
     dispatch "DeleteIndex" to grp "datagrid" with theIndex
You will need to change the names used in the above script to reflect your dataGrid.

I hope this helps.

Kind Regards

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding

--

Post Reply

Return to “idea2app and Coding School”