logo
down
shadow

Vue - how to bind table column to a data object?


Vue - how to bind table column to a data object?

Content Index :

Vue - how to bind table column to a data object?
Tag : development , By : CrookedNumber
Date : November 25 2020, 03:01 PM

it should still fix some issue
I can't use v-for, as the table and its rows are all generated server side
<table id="app">
    <tr>
        <td>1</td> 
        <td>{{ applications.party_1.num }}</td>
    </tr>
    <tr>
        <td>2</td> 
        <td>{{ applications.party_2.num }}</td>
    </tr>
</table>
applications: {
  party_1: { num: 1 },
  party_2: { num: 2 }
}
new Vue({
  el: '#app',
  data: {
    applications: {
      party_1: { num: 1 },
      party_2: { num: 2 }
    }
  }
});

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Trying to data-bind object array using knockout.js into table


Tag : knockout.js , By : cautionsign
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You can access the current iteration of foreach binding with $data variable. also you might want to replace
<td data-bind="foreach: Cells">
<!-- ko foreach: Cells -->
 <td data-bind="style:{'background-color':$data}></td>
<!-- /ko -->

Propel object collection bind column alias to the foreign table object insted of getting it out


Tag : mysql , By : David B
Date : March 29 2020, 07:55 AM
I wish this help you I have two db tables one is Item and the other (Unit) is represent all the measure units available for Item table. In this scenario Item table contains a foreign key of Unit table which acts as one to many relation. , Below approach worked for me :
$items = \ItemQuery::create()
            ->joinWith('Item.Unit')
            ->withColumn("CONCAT (Unit.Name,'-',Unit.Label)", "MUnit")
            ->find();
        foreach ($items as $i) {
            $i->getUnit()->setVirtualColumn('Asdf', $i->getVirtualColumn('MUnit'));
        }
        dd($items->toJSON());
...

 "Items":[
      {
         "Id":2,
         "Code":"M000002",
         "Name":"Item 1",
         "Price":234,
         "UnitId":1,
         "MUnit":"Kilograms-Kg",
         "Status":true,
         "Unit":{
            "Id":1,
            "Name":"Kilograms",
            "Label":"Kg",
            "Status":true,
            "Asdf":"Kilograms-Kg",// here goes...
         }
      },
       ...

How can I row bind the unmatch data in the column of first table from the second table


Tag : r , By : Chris Lomax
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further , Try to left join df2 and df1 and replace NA with 0.
df3 <- merge(df2, df1, all.x = TRUE)
df3$number[is.na(df3$number)] <- 0
df3

#  a number
#1 a      4
#2 b      3
#3 c      2
#4 k      0
#5 z      0
library(dplyr)
df2 %>%
  left_join(df1, by = "a") %>%
  mutate(number = replace(number, is.na(number), 0))
df3 <- df2
df3$number <- df1$number[match(df2$a, df1$a)]
df3$number[is.na(df3$number)] <- 0
df1 <- data.frame(a = c("a", "b", "c"), number=c(4,3,2))
df2 <- data.frame(a = c("a", "b", "c", "k", "z"))

ASP.Net MVC :Jquery Data table with dynamic column bind with JSON


Tag : jquery , By : ponchopilate
Date : March 29 2020, 07:55 AM
Hope that helps Sorry i just could solve it. the moment i add title in column along with data then problem goes out.
see my working code
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            TestData t = new TestData();
            List<columnsinfo> _col = new List<columnsinfo>();

            DataTable dt = new DataTable();
            dt.Columns.Add("ID", typeof(Int32));
            dt.Columns.Add("Name", typeof(string));

            DataRow dr = dt.NewRow();
            dr[0] = 1;
            dr[1] = "Ajay";
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = 2;
            dr[1] = "Sanu";
            dt.Rows.Add(dr);

            for (int i = 0; i <= dt.Columns.Count - 1;i++ )
            {
                _col.Add(new columnsinfo { title = dt.Columns[i].ColumnName, data = dt.Columns[i].ColumnName });
            }

            string col =  (string)serializer.Serialize(_col);
            t.columns = col;


            var lst = dt.AsEnumerable()
            .Select(r => r.Table.Columns.Cast<DataColumn>()
                    .Select(c => new KeyValuePair<string, object>(c.ColumnName, r[c.Ordinal])
                   ).ToDictionary(z => z.Key, z => z.Value)
            ).ToList();

            string data= serializer.Serialize(lst);
            t.data = data;

            return View(t);
@model JQDataTable.Controllers.TestData

@{
    Layout = "";
    ViewBag.Title = "Home Page";
}


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/responsive/2.1.1/css/responsive.bootstrap.min.css" rel="stylesheet" />

<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap4.min.js "></script>

<div style="display:none;" class="row">
    <div class="form-group">
        @Html.HiddenFor(m => m.columns, new { @id = "dataObjCol", placeholder = Html.DisplayNameFor(m => m.columns), @class = "form-control" })
        @Html.HiddenFor(m => m.data, new { @id = "dataObjData", placeholder = Html.DisplayNameFor(m => m.data), @class = "form-control" })
    </div>
</div>
<hr />

<div class="row">
    <div>
        <table class="table table-striped table-bordered table-hover"
               id="TableId"
               cellspacing="0"
               align="center"
               width="30%" border="1"></table>
    </div>
</div>
<hr />

<script type="text/javascript">
    $(document).ready(function () {
        //debugger;
        alert($('#dataObjCol').val());
        var dataObjCol = JSON.parse($('#dataObjCol').val());
        var dataObjData = JSON.parse($('#dataObjData').val());

        // Datatable settings.
        $('#TableId').DataTable(
        {
            "data": dataObjData,
            "columns": dataObjCol,
            "bPaginate": false,
            "bFilter": false,
            "bInfo": false,
            "autoWidth": false,
            "bSort": false,
            "columnDefs": [
                    {
                        "width": "28px",
                        "targets": "0",
                        "className": "text-right"
                    },
                    {
                        "width": "2px",
                        "targets": "1",
                        "className": "text-right"
                    }
            ]
        });
    });
</script>
public class TestData
    {
        public string jsondata { get; set; }
        public string columns { get; set; }
        public string data { get; set; }
    }

     public class columnsinfo
     {
         public string title { get; set; }
         public string data { get; set; }
     }

How can I bind dynamic resource key value with column value in data table in wpf


Tag : wpf , By : Michael
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Is it acceptable for invalid XHTML?
  • Anyone soloing using fogbugz?
  • Using MBUnit in TeamCity
  • How to setup a crontab to execute at specific time
  • Linking two Office documents
  • How can I detect if a browser is blocking a popup?
  • Apply filter to t-foreach
  • Lotus Notes convert formula to agent
  • Problem with configuration of odoo for working with pycharm
  • Unexpected number of arguments when calling EM_JS function
  • What does the function state_fidelity() do in Qiskit?
  • Azure function with IoT Hub trigger get send device
  • Cluster similar words using word2vec
  • Add elements into an array then find distinct,
  • Angular8 - error TS2304: Cannot find name
  • Manually polling streams in future implementation
  • How do you perform receipt validation for Android on Xamarin Forms
  • What is the rule behind instruction count in Intel PIN?
  • How to draw some text when click a button in wxWidgets?
  • Restrict entity types in Spacy NER
  • How to animate CN1 Slider progress on load
  • Issue with bwa mem process not running on all output files from previous process
  • Delete videos from playlist using YouTube API
  • How to restart the Hyperledger Composer Playground locally
  • How to configure email alerts in Zabbix Server?
  • Simulator is not working for smart home action with all configured session
  • How parse data using join on Objection.js
  • Assign an array to a property in a Chapel Class
  • Netlogo: How can I obtain the accumulate value in Netlogo?
  • How to populate datasource for listview using api response in react native?
  • Why does gmail API when using history.list method send message ids without the field what action has been preformed on t
  • How to run an append query in ms access vba as part of a transaction
  • Wrong dates shown in Jekyll-based blog
  • How to concatenate two document lists in a webMethods flow service?
  • How to properly set up a site map addition in a customization project
  • IBM Content Collector error calling external Web Service
  • Is (0*1*)* equal to (0 | 1)*?
  • How do I configure phpMyAdmin to start with a blank sql query from the SQL tab?
  • "Objects are not valid as a React child" Redux error when conditionally connecting a component?
  • Displacy results are not showing
  • Strapi / Graphql. What am i doing wrong?
  • How to add Search bar for django template?
  • lookup in presto using single column against a range in lookup table
  • How can you stop videos being stolen on website?
  • Can't code substitution happen in Hybrid Flow?
  • Removed widget remains on parent
  • setup saga middleware with redux-starter-kit's configureStore()
  • How to get cookies from response of scrapy splash
  • I need to do a firebase stream and not a Http Get
  • Unable to compile node-runtime
  • SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
  • How to extract only the number from a variable
  • disable linter in DAML studio
  • RxJS: How to set exhaustMap concurrent?
  • How to remove perforce (p4) on Ubuntu
  • How do they know mean and std, the input value of transforms.Normalize
  • Why this type is not an Interface?
  • SugarCRM Rest API set_relationship between Contacts and Documents
  • Jira dashboard organization
  • Web worker importScripts fails to place script variables in global scope
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com