• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is there any way to create editable table in a JSX dialog box?

Explorer ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

I have created a table in JSX dialog box using multiple column list as follows.

var dlg = new Window("dialog", "Animation List");

dlg.frameLocation = [100,100]; // position

dlg.size = [750, 250];

//table initailize

var w0=150, w1=150 ;

   

table = dlg.add ("listbox", {x:20, y:20, width:300, height:150}, undefined, { numberOfColumns:6, showHeaders:true,

columnWidths: [w0,w1],

columnTitles:["First Name", "Last Name"] });

table.add("item", "Namodaya");

table.items[0].subItems[0].text = "Balaarachchi";

 

dlg.show();

Output table:

3.PNG

But I want to edit the cells in the table. Is there any way to achieve this?

TOPICS
Actions and scripting

Views

929

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

There is a Scripting forum.  It only gets a half dozen posts a day, and it is not unlikely the people who follow the scripting forum also follow this one, but you'd still get a better chance of a useful reply over there.

Photoshop Scripting

We can move this thread to that forum if you like, or you can copy your post to a new thread over there?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

Ok. I will move it photoshop scripting discussion.

Thank you very much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

Your discussion moved to Photoshop Scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

Ok. Thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

As a way, define the function

table.onDoubleClick = function ()
{
// here place the form call to edit the current table element
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 17, 2017 Nov 17, 2017

Copy link to clipboard

Copied

Thank you for your quick response.

I tried to fix this issue with your solution. But still I couldn't understand how to edit current cell when a user clicks the cell.

Also, there has a problem how to get the current position of the cell when the table is scrollable as below.

var dlg = new Window("dialog", "Animation List"); 

dlg.frameLocation = [100,100]; // position 

dlg.size = [750, 250]; 

 

 

//table initailize  

var w0=150, w1=150 ; 

     

table = dlg.add ("listbox", {x:20, y:20, width:300, height:150}, undefined, { numberOfColumns:6, showHeaders:true,  

columnWidths: [w0,w1],  

columnTitles:["First Name", "Last Name"] }); 

 

for( var i = 0; i < 20 ; i++ )

{

    table.add("item", "Namodaya");  

    table.items.subItems[0].text = "Balaarachchi"; 

}

table.onDoubleClick = function () 

    // here place the form call to edit the current table element 

dlg.show(); 

2.PNG

Could you please explain?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 17, 2017 Nov 17, 2017

Copy link to clipboard

Copied

I think this is what r-bin​ meant.

var dlg = new Window("dialog", "Animation List"); 

dlg.frameLocation = [100,100]; // position 

dlg.size = [750, 250];  

//table initailize  

var w0=150, w1=150 ;      

table = dlg.add ("listbox", {x:20, y:20, width:700, height:150}, undefined, { numberOfColumns:6, showHeaders:true,  

columnWidths: [w0,w1],  

columnTitles:["First Name", "Last Name","Field 3","Field 4","Field 5","Field 6"] }); 

table.add("item", "Namodaya");  

table.add("item", "Fred");

table.items[0].subItems[0].text = "Balaarachchi"; 

table.items[0].subItems[1].text = "asdfghjkl";

table.items[1].subItems[0].text = "Bloggs"; 

table.onDoubleClick = function(){

     var w = new Window("dialog", "Edit Text");

     //Add fields to suit

     w.et1 = w.add("edittext");

     w.et1.preferredSize=[200,20];

     w.et1.text= table.selection.text;

     w.et2 = w.add("edittext");

     w.et2.preferredSize=[200,20];

     w.et2.text = table.selection.subItems[0];

    w.p = w.add("button",undefined,"Update");

    w.add("button",undefined,"Cancel");

    w.p.onClick=function(){

        table.selection.text=w.et1.text;

        table.selection.subItems[0].text = w.et2.text;

        w.close(0);

        }

    w.show();

     }

dlg.show();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 17, 2017 Nov 17, 2017

Copy link to clipboard

Copied

Thank you.

I have tested your example. There you mean edit text in a separate window as below.4.PNG

But actually, I want to edit table in itself as below. (Like Microsoft Excel)

1.PNG

Is there any way to do this using Photoshop scripting?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 17, 2017 Nov 17, 2017

Copy link to clipboard

Copied

Nope.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 19, 2017 Nov 19, 2017

Copy link to clipboard

Copied

LATEST

Thanks a lot.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines