logo
down
shadow

Add an expandable text box to every post


Add an expandable text box to every post

By : user2956976
Date : November 22 2020, 03:03 PM
wish of those help So I am building a comment system and have loaded a bunch of comments to a page, then have generated a reply box for each. Below is what my reply box looks like, but there are many identical ones on each page. As you can see, the first portion is a div that contains a toggle (show/hide) for the reply box.
code :
$(document).on('click', '#reply-toggle', function() {
    $(this).closest('.col-sm-offset-1').next('#reply-div').slideToggle('slow');
});


Share : facebook icon twitter icon
Grid of expandable posts, post contents in div below row

Grid of expandable posts, post contents in div below row


By : Marko Gledic
Date : March 29 2020, 07:55 AM
this will help I'm not exactly sure what your preferred implementation would be, so I'll offer a couple options.
The first option is similar to you put together on jsFiddle, except I wrapped the "trigger"
tags in a
of their own and added a "content"
tag to the single "content"
tag that you were sliding down and up... easier explained in code:
code :
    <div id="row1" class="item-info">
        <div class="item">item-1</div>      
        <div class="item">item-2</div>
        <div class="item">item-3</div>
        <div class="item">item-4</div>
    </div>
    <div id="contentRow1" class="item-info" style="display:none;">
        <div class="item-content">content div for item-1</div>      
        <div class="item-content">content div for item-2</div>
        <div class="item-content">content div for item-3</div>
        <div class="item-content">content div for item-4</div>
    </div>
Keep the expandable div open after the page post back

Keep the expandable div open after the page post back


By : Rohini
Date : March 29 2020, 07:55 AM
may help you . Add a hidden input to your form and give it a distinguishable ID or Class. This will post true if the div is expanded. Give it an initial value of "false" if you like.
Then add the line:
code :
$('.toggler1').live('click', function () {
    $('#MyHiddenInputNamedBetter').val('true'); // Add this line
<% If isPostBack AndAlso CBool(Request.Form('MyHiddenInputNamedBetter')) Then %>
    <script>
        $('.toggler1').parent().children().toggle(); // .... etc.
    </script>
<% End If %>
Expandable view and text

Expandable view and text


By : sach
Date : March 29 2020, 07:55 AM
like below fixes the issue Using Autolaout you extend the height of your textview based on content size and your view
Edit Text as Parent and its Text View as Child to Expandable listView

Edit Text as Parent and its Text View as Child to Expandable listView


By : rakeshj
Date : March 29 2020, 07:55 AM
I wish this helpful for you I am trying to send the Edit text into expandable list view. First Edit Text.Sorry i could not post my screen shot due to reputation purpose should be a parent and second should be stored as its child in expandable list view after clicking the save Button. , Change your Code according to this. I have done this for you.
code :
public class CustomExpandableListAdapter extends BaseExpandableListAdapter {

private Context context;
private String expandableListTitile;
private ArrayList<String> expandableListDetail;


public CustomExpandableListAdapter(Context context, String expandableLIstTitle,
                                   ArrayList<String> expandableListDetail){
    this.context = context;
    this.expandableListTitile = expandableLIstTitle;
    this.expandableListDetail = expandableListDetail;
}
    @Override
    public Object getChild(int listPosition, int expandedListPosition) {
        return this.expandableListDetail
                .get(expandedListPosition);
    }

    @Override
    public long getChildId(int listPosition, int expandedListPosition) {
        return expandedListPosition;
    }

    @Override
    public View getChildView(int listPosition, final int expandedListPosition,
                             boolean isLastChild, View convertView, ViewGroup parent) {
        final String expandedListText = (String) getChild(listPosition, expandedListPosition);
        if (convertView == null) {
            LayoutInflater layoutInflater = (LayoutInflater) this.context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = layoutInflater.inflate(R.layout.list_item, null);
        }
        TextView expandedListTextView = (TextView) convertView
                .findViewById(R.id.expandedListItem);
        expandedListTextView.setText(expandedListText);
        return convertView;
    }

    @Override
    public int getChildrenCount(int listPosition) {
        return this.expandableListDetail
                .size();
    }

    @Override
    public Object getGroup(int listPosition) {
        return this.expandableListTitile;
    }

    @Override
    public int getGroupCount() {
        return 1;
    }

    @Override
    public long getGroupId(int listPosition) {
        return listPosition;
    }

    @Override
    public View getGroupView(int listPosition, boolean isExpanded,
                             View convertView, ViewGroup parent) {
        String listTitle = (String) getGroup(listPosition);
        if (convertView == null) {
            LayoutInflater layoutInflater = (LayoutInflater) this.context.
                    getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = layoutInflater.inflate(R.layout.list_group, null);
        }
        TextView listTitleTextView = (TextView) convertView
                .findViewById(R.id.listTitle);
        listTitleTextView.setTypeface(null, Typeface.BOLD);
        listTitleTextView.setText(listTitle);
        return convertView;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public boolean isChildSelectable(int listPosition, int expandedListPosition) {
        return true;
    }
}
public class MainActivity extends AppCompatActivity {


EditText textIn, txtHeading;
Button buttonAdd, btnsave;
TextView textViewOut;
LinearLayout container;
protected static final String Shared = null;
ExpandableDataPump expandableDataPump;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    expandableDataPump = new ExpandableDataPump();


    textViewOut = (TextView) findViewById(R.id.textout);
    textIn = (EditText) findViewById(R.id.textin);
    txtHeading = (EditText) findViewById(R.id.heading);
    buttonAdd = (Button) findViewById(R.id.add);
    container = (LinearLayout) findViewById(R.id.container);


    buttonAdd.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {


            LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final View addView = layoutInflater.inflate(R.layout.list_view, null);

            TextView textOut = (TextView) addView.findViewById(R.id.textout);

            textOut.setText(textIn.getText().toString());


            Button buttonRemove = (Button) addView.findViewById(R.id.remove);
            buttonRemove.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    ((LinearLayout) addView.getParent()).removeView(addView);
                }
            });

            container.addView(addView);
        }
    });

    btnsave = (Button) findViewById(R.id.btn_save);
    btnsave.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            try {
                Intent intent = new Intent(getApplicationContext(), ExpandableList.class);
                String Heading = txtHeading.getText().toString();
                intent.putExtra("Heading", Heading);

                intent.putStringArrayListExtra("Options", (ArrayList<String>) expandableDataPump.getData());
                startActivity(intent);

            } catch (Exception ex) {
                ex.printStackTrace();

                Toast.makeText(MainActivity.this, "You have an ERROR", Toast.LENGTH_LONG).show();
            }


        }
    });

}

public class ExpandableDataPump {
    public List<String> getData() {
        List<String> childs = new ArrayList<>();
        for (int i = 2; i < container.getChildCount(); i++) {
            if (container.getChildAt(i) instanceof RelativeLayout) {
                childs.add(((TextView) container.getChildAt(i).findViewById(R.id.textout)).getText().toString());

            }
        }
        return childs;

    }
}
}
public class ExpandableList extends AppCompatActivity {
private static final String Shared = null;

ExpandableListView expandableListView;
ExpandableListAdapter expandableListAdapter;
String expandableListTitle;
ArrayList<String> expandableListDetail;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.expandable_list);


    expandableListDetail = getIntent().getStringArrayListExtra("Options");

    expandableListTitle = getIntent().getStringExtra("Heading");


    expandableListAdapter = new CustomExpandableListAdapter(this, expandableListTitle, expandableListDetail);


    expandableListView.setAdapter(expandableListAdapter);
    expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {

        @Override
        public void onGroupExpand(int groupPosition) {

            Toast.makeText(getApplicationContext(),
                    expandableListTitle + " List Expanded.",
                    Toast.LENGTH_SHORT).show();
        }
    });

    expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {

        @Override
        public void onGroupCollapse(int groupPosition) {
            Toast.makeText(getApplicationContext(),
                    expandableListTitle + " List Collapsed.",
                    Toast.LENGTH_SHORT).show();

        }
    });

    expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v,
                                    int groupPosition, int childPosition, long id) {
            Toast.makeText(
                    getApplicationContext(),
                    expandableListTitle
                            + " -> "
                            + expandableListDetail/*.get(
                            expandableListTitle.get(groupPosition)).get(
                            childPosition)*/, Toast.LENGTH_SHORT
            ).show();
            return false;
        }
    });
}}
Sizing of Header Text for Expandable Text

Sizing of Header Text for Expandable Text


By : Priestch
Date : March 29 2020, 07:55 AM
it should still fix some issue I am trying to change the spacing in between the headers of my expandable sections as seen here. I have figured out how to change the font size, but as I increase the size, the headers begin to overlap each other. I am really new at this, so sorry if this is an obvious answer. I am using Squarespace as my host. , add this to your css code
code :
div[onclick^=openClose] {
    margin-bottom:  20px;
}
<style>
    div[onclick^=openClose] {
        margin-bottom:  20px;
    }
</style>
Related Posts Related Posts :
  • es lint '' is assigned a value but never used' eventhough i have used it
  • Can "name" attribute be used for custom VueJS components
  • Get innerHTML of content when it is clicked
  • HTTPS causes CSS animations to not load? Very confused
  • How to hide other div apart from touched div to the band
  • Is global variable assignment atomic on NodeJS?
  • Datepicker onchangemonthyear beforeshowday
  • trying to render html files using jade but it still adresses it as a jade
  • Google Analytics - Understanding and Dissecting the Snippet: What is | | [ ];
  • Replacing "[aA09.b]." to "[aA09.b]\n" in in JavaScript
  • Why wrap a function definition in an immediate function?
  • Enable / disable jQuery script on switching to different tab in a HTML page
  • how can find return variable value outside anonymous function in node js mysql query function
  • Converting 1 to 0001 in javascript array
  • svg viewbox should not resize the text fontSize?
  • store newline character with string in a variable
  • MP4 videos in Flowplayer does not play in Windows 7 Chrome
  • jquery focusin event not firing
  • How to debug Vue application with google chrome
  • html 5 web app cache download complete javascript alert?
  • Ember.js setupController fired only once
  • How to validate a currency input
  • How to convert my Array of data to key & value pair
  • Statistics circles in CSS
  • So I wanted to make a trig solver in javascript?
  • Showing HighCharts series name on x-axis and in legend
  • In Rails, how can we pass parameters in script?
  • Build Fails: `npm rebuild node-sass --force`
  • Angular Datepicker change dateformat
  • Trying to extract data from between two sets of characters
  • Configuring Jest in WebStorm
  • Uncaught Error: Syntax error, unrecognized expression: tr.ec_portfolio_title,
  • JQuery fading in fading out continuously
  • Unexpected end of input (Line 1) and Undefined Function?
  • How to animate the width of a div slowly with jquery
  • JavaScript + RegEx Complications- Searching Strings Not Containing SubString
  • SignalR - Unable to get property 'client' of undefined or null reference
  • full calendar not displaying when loaded (with backbone)
  • Angular: Update service and share data between controllers
  • ReplaceAll Google script
  • Search for matching LI items in separate UL
  • Access arguments of an... argument
  • Customizing Google custom search jsapi (query strings)
  • React | Can´t load Images > Module not found
  • Dynamically creating buttons in DOJO
  • 404 Not Found in AJAX post call
  • How do I find out, using javascript, what software opened and running my application?
  • Javascript to check the status of wireless connection
  • StarDict support for JavaScript and a Firefox OS App
  • Phonegap event Resume
  • call javascript function on ENTER key press?
  • When is the best time to remove no-js classes from the html tag
  • Recommended email sending languages
  • setInterval not working properly with chrome
  • Does IE create new scope for each script tag?
  • Uncaught SyntaxError: Unexpected token < Underscore and parse issues
  • How to pass captured URL to Email Body in HTML
  • How to structure default nested resources?
  • Store all the keys of a JSON object in a variable
  • Need an efficient way to group the Array of object in javascript
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org